Ctrl K
Problem

Counting Grid Routes

Medium · Counting Grid Routes

A district is laid out in square blocks: its streets form a grid of `rows` rows and `cols` columns of intersections. A courier stands at the top-left intersection and has to deliver an order to the bottom-right one. To save time, the courier only ever moves down or right to a neighbouring intersection. Return the number of distinct routes from the start to the delivery point. The answer is guaranteed not to exceed 2·10⁹.…

Solve the problem →