i have already solved this. And my code is also working quite well in coding blocks but here it is failing all the test cases.
please tell what wrong in code!
Doubt in Arrays-Wave print Column Wise
hey @shubham.mehla2000, you logice is not correct. Why are you taking reminder and than making with it and the number formed is also of 2 digit number only. Number can be of any number of digit.
Consider this case
4 4
110 121 132 14
210 221 232 24
310 321 332 34
410 421 432 44
Your code is giving this output
11, 121, 231, 41, 42, 232, 122, 12, 13, 123, 233, 43, 44, 234, 124, 14, END
This question is very simple, just run 2 loops, when column index is even then print up to down and when column index is odd then print down to up.
you mean 0 should also be there in the begining of number like
011 for 110, not 11 for 110 right?
and also only this need to solve , is rest of the code fine!
hey @shubham.mehla2000, your logic is not correct. Forget about 3 digit numbers like 011, your code even giving wrong answer for 2 digit numbers.
Consider this case for example
2 2
11 22
33 44
you output 11, 22, 44, 33, END
Please change your complete approach.
i am really sorry ! i didn’t get it .
what should be the output then?
in sample input and out given in the questions are also like this
sample intput
4 4
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
sample output
11, 21, 31, 41, 42, 32, 22, 12, 13, 23, 33, 43, 44, 34, 24, 14, END
hey @shubham.mehla2000, I am giving you correct outputs as well as output of your code. You can see the difference on your own
input
4 4
110 121 132 14
210 221 232 24
310 321 332 34
410 421 432 44
your output
11, 121, 231, 41, 42, 232, 122, 12, 13, 123, 233, 43, 44, 234, 124, 14, END
correct output
110, 210, 310, 410, 421, 321, 221, 121, 132, 232, 332, 432, 44, 34, 24, 14, END
input
2 2
11 22
33 44
your output
11, 22, 44, 33, END
correct output
11, 33, 44, 22, END
ohh,i got it.
i misinterpreted the question.
thank you!
ya sure, i got all the test cases correct now!