You are viewing a single comment's thread. Return to all comments →
I think where most people are having problems (and where I was having problems) is that the array is being read in and then processed on opposite coordinates ( e.g. read in as (x, y) but then process as (y, x) ).
I decided this was the problem for me after I read in the array as a 1D array and then was able to solve no problem.
thanks man, didn't realize this without your hint
This is true. I tried outputting the matrix to the screen in standard x,y format, it does not look like the input. This caused a lot of confusion and time wasted while debugging. IMO, Hackerrank should fix this.
I consider it a good lesson in paying attention to existing code (I fell prey to this problem as well)
It doesn't help that the initial test case passes when the indexing is switched.
That was the thing. Misleading pre provided scanning code. It scans by columns - not by rows - which I assume most would not expect. I was so sure mine was right but had no idea why certain test cases were failing. Only thing I had to change was to switch the for statements (outer to inner and inner to outer) and all test cases passed.
Yours is the most observant and helpful comment. Thanks much
thanks dear you solve my problem i am face this problem from last two days, one again a lot of thanks how to communicate with cats
thanks bro, you saved my day!!
2d matrix usually has array[row][column] format, not x,y
Yes, this problem set a little trap.