Through the Grid

Published by Mubashir Hassan in

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

Check the Resources tab for a detailed explanation.

Watch a quick demo on how Edabit works.