Guys…
I think the sample test case given is wrongly explained…
If yes… please let me know… coz… the author or the tester of the problem is not responding in the comment sections… I couldn’t even dare to start with out confirming whether i understood it right or not…
Please visit the comment section of the problem(given in the above link) to read my comment…
I don’t see your comment, but I believe sample test case is wrongly explained. They are talking about 2x2 grid, with top-left corner as (2,1) ans bottom right as (3,2), but it should be 1x1 grid, not 2x2