A Wealthfront interface models a navigation flow as an n x m grid. Starting at the top-left cell, a user may move only one cell right or one cell down. Return the total number of distinct paths to the bottom-right cell.
The result must be exact. Do not construct the full grid or use a recursive solution that recomputes the same states.
Implement unique_paths(rows, cols), where rows and cols are positive integers. Return an integer equal to the number of valid paths from (0, 0) to (rows - 1, cols - 1).
A valid path contains exactly rows - 1 down moves and cols - 1 right moves. Since the answer can be very large, use Python's arbitrary-precision integers.
def unique_paths(rows, cols):