Count Grid Paths Without Three Consecutive Moves in the Same Direction

A frog starts at (0, 0) and needs to reach (7, 4).

At each step, it may move either:

  • one unit right, denoted by R; or
  • one unit up, denoted by U.

The move sequence must not contain three...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: