LearnPy Hub
← Decorators problems
Medium

lru_cache Speed-up

Use @functools.lru_cache on a recursive function counting the paths in an r×c grid moving only right or down. Print the count.

Input

Two integers r and c (1–30).

Output

The number of paths.

Sample 1

Input
2
2
Output
2

Sample 2

Input
3
3
Output
6
solution.py
Output appears here
lru_cache Speed-up · Python practice problem · LearnPy Hub