Grid Paths with Alternating Steps
Sequel to https://puzzlespree.substack.com/p/grid-paths-with-variable-steps
Compute the number of distinct paths in an m x n grid from the top-left to the bottom-right corner, where each move follows a dynamic step size sequence. Starting with any step size from 1 to a given limit, subsequent steps proceed in a round-robin pattern, cycling through the range. Paths must stay within grid boundaries.
Examples:
count_paths(m=1, n=2, limit=2)returns2:D1R2,R2D1count_paths(m=3, n=2, limit=2)returns2:R2D1D2,D2D1R2count_paths(m=3, n=4, limit=3)returns3:D1D2R3R1,R1D2R3D1,R1R2D3R1


