Dont know how to approach these type of questions(pure logic based)

hello @all ,this is not purely programming related question but it is related somehow…i am weak in maths and i face difficulty on attempting the question which involve some crazy mathematics like this i know there is some maths or some repetitive pattern behind the scenes but i usually don’t get what it is.Any suggestion from you guys because my aim is not to get good rating but to do 700+ question till dec’15…and there are many question of these kind.So this is the hurdle.Should i read some reasoning books or anything else.please guys do comment.

Try learning basic number theory from topcoder tutorials.


thanks a lot…but what my main concern is these type of question link.I dont know even the category in which they come.I am comfortable with the standard algorithms you have mentioned in the link above.

In these type of problems, you have to look for patterns as you pointed out. Though this problem does not involve any crazy mathematics.

These type of problems require you to make observations based on the problems.

Some observations which I made to solve this question was

  • In n\times n grid, odd n leads to right facing and even n leads to left facing in the end.
  • In rectangular grid, i.e. n\times m grid and n\neq m the smaller of n and m matters. The larger one has no role.

Then you can choose to prove those made observations but that would be crazy mathematics. So if you don’t want to indulge in those things, some easy problems can be solved by making such observations.