Problems > Routes Across a Grid > Editorial

Routes Across a Grid — Solution & Editorial

Back to the Problem

A route is a shuffle of H−1 downs and W−1 rights: C(H+W−2, H−1). Compute with factorials or an incremental product plus modular inverse.

Complexity: O(H + W)