Interview Query

NxN Grid Traversal

2
Have you seen this question before?

Given an integer nn, write a function traverse_count to determine the number of paths from the top left corner of an n×nn\times n grid to the bottom right. You may only move right or down.

Example:

Input:

n = 2

Output:

def traverse_count(n) -> 2

As our two options for a 2x2 grid:

start
end

are only to go right then down, or down then right. So there are two possible paths.

Next question: Friend Requests Down
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code