Also reported as LeetCode 79
Amazon coding question, reconstructed from 3 candidate reports (May 2026 to September 2026). Tests: dynamic programming and backtracking; tries and prefix search. Candidates reported 1 follow-up. The write-up includes a Python solution that passes 9 test cases.