Count or list?
transcript
Which technique does the story want? Ask one question first. Count, or list? The wrong choice wastes the whole interview.
The number of ways needs a table. So does the largest total. So does a yes or no. Each of these has one answer, not a list of answers. They share one shape: a state, a step and a start.
Sixty digits can have two and a half trillion readings. You could never list them. A table counts them in sixty steps. A table of sixty entries is enough.
Backtracking lists every option. It takes a choice, recurses, and undoes it. And it returns one page of a long list. Even then, the list is cut into small pages.
Say the state in words first. Then the transition from earlier entries. Then the base case, often the empty start. Interviewers remember a clear state.
The question picks the tool. Decide before you code. Full breakdown in the lecture.