Intuition
Build out the combinations recursively and append them to the result. May be tempting to use for loops but the code is more complicated for no real gain…just keep it simple.
Implementation
Visual
Review 1
The iterative solution is probably more intuitive:
Implementation (iterative)
Note on the time complexity: Each digit can have at most 4 possibilities therefore the complexity is o(4**n) where n is the number of digits. Think in bits!