how does this problem of concentric rectangle works , can I get some kind of explanation
Nested for loop question
I hope you are asking the question in which sir has shown the use of max function and how to print that rectangle.
It will return the max element from x+1,y+1,n-x,n-y
In python we can use max function to get the maximum value out of given some values such as for example if we have max(1,3,4,2,7,9,8,5,6) it will return value 9
So here we are focused with the max value at each step from the given inputs
so max(x+1,y+1,n-x,n-y) is there
for ex. of 3
if x = 0
and y = 0
then max(1,1,3,3) = 3
and y = 1
then max(1,2,3,2) = 3
and y = 2
then max(1,3,3,1) = 3
if x = 1
and y = 0
then max(2,1,2,3) = 3
and y = 1
then max(2,2,2,2) = 2
and y = 2
then max(2,3,2,1) = 3
if x = 2
and y = 0
then max(3,1,1,3) = 3
and y = 1
then max(3,2,1,2) = 3
and y = 2
then max(3,3,1,1) = 3
so overall it is
3 3 3
3 2 3
3 3 3
So I hope it is clear to you what is the max function.
In case you feel any doubt or confusion you are free to ask, I will surely help you out.
In case you understand this pls mark it as resolve and pls rate as well as provide the feedback so that we can improve our services.
Thanks
Happy Coding !!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
yes thankyou , now I have understood