As reported: Walmart Senior Software Engineer hiring drive, round 2 coding (Mar 2026): you may climb 1, 2 or 3 steps at a time; count the ways to reach step
n, where the order of the steps does not matter — forn = 3the ways are1+1+1,1+2and3(2+1is the same as1+2).
Counting combinations (not orderings) of step sizes that sum to n is the coin change "number of combinations" problem with coins [1, 2, 3]. The runner uses the general version:
Given an amount and an array of distinct coins, return the number of combinations of coins (each usable any number of times) that sum to amount.
This is LeetCode 518 — Coin Change II.
Example
amount = 3, coins = [1,2,3] -> 3 (1+1+1, 1+2, 3)
amount = 5, coins = [1,2,5] -> 4
amount = 3, coins = [2] -> 0
Constraints: 1 ≤ coins.length ≤ 300; 1 ≤ coins[i] ≤ 5000, distinct; 0 ≤ amount ≤ 5000; the answer fits in a signed 32-bit integer.
Code runner format: one JSON value per line: amount, then coins. Implement change(amount, coins); the harness prints the count.