res_and_ser's blog

By res_and_ser, 6 years ago, In English

Hello codeforces

I recently encountered this problem in an interview.

You have an infinite grid. You know the value of m and n and you need to find number of paths from (0 , 0) to (m , n) with condition that you are allowed to move up, down, left and right.

How to do this?

  • Vote: I like it
  • -21
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it +51 Vote: I do not like it

Are you sure that you can walk up and to the left?

If so, then the answer, I think, is infinity

»
6 years ago, # |
  Vote: I like it +5 Vote: I do not like it

I think there are some limits in this problem. E.g. you cant go out from n*m rectangle and you can visit each cell no more than one time.

»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Maybe you want to ask different simple ways? i.e. there are not cycles.