the third for loop of going up from the bottom in the column is executing, which is the repetition, hows to stop this.
Repetition of column
Hello @prashantgupta9876 i think in loop you must have written the condition that the loop should run till the row is greater then or equal to zero.
yes, that’s the case, I dry run that code, but unable to think further. May you give a hint so that I can think forward
please share your code i will correct it.
Can you check from my submission?
Hello @prashantgupta9876 this is the corrected code :
if you dont understand anything you can ask here:
Happy Learning!!
its still there
check this I have generated the matrix of (5,3)
Hello @prashantgupta9876 the code which you have shared was not passing all the test cases.
so i have corrected according to that.
now your code is passing all the test cases.
Sir, for the question this answer is not correct even with both using conditions commented or without commented
you have used the if conditions at wrong place .
i have changed your if conditions.
now it is passing all the test cases on hackeblocks.
but i am still checking for the test case which you finding it wrong.
this code is also producing repetition.
Please wait.
Yes, sir i got it about the wrong if condition but the current solution is giving still repition for the 5*3 mattrix
Yes, got the answer.
May you please explain the idea behind this approach in the place of the previous one, Why we have changed? and what’s wrong with the last approach.
Here we are having the count of the variables so if that number of variables we have printed then there is no need to run the while loop anymore .
Simple!!
yes, But like we did one question in the tutorial of the clockwise spiral there we did with the if condition and it worked.
Hey @prashantgupta9876 all the basic test cases are passing with that also.
the code which you have shared .
if your doubt is cleared please mark this doubt as resolved.
Happy Learning!!
Ya sure, thank alot sir.
welcome!
Happy Learning !!