← Back to challenges

Through the Grid

PythonHardalgorithmsnumberslogic

Instructions

How many ways are there to navigate through a grid (w * h)?

Grid

Suppose you're on a 4 × 6 grid, and want to go from the bottom left to the top right. How many different paths can you take? Avoid backtracking, you can only move right or up.

Create a function that takes width and height and returns the amount of possibilities.

Examples

grid_pos([1, 1]) ➞ 2

grid_pos([6, 4]) ➞ 210

grid_pos([5, 5]) ➞ 252

Notes

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.