Leetcode 17: Phone key combinations

Use recursion to walk through the combination space. I use an array of codes, which maps the index to the letter combinations for that index. In the recursive function we loop through all the possible letters for the current number and then recurse into the next digit. I use backtracking to save on creating a whole new combination string for each recursive call.

This entry was posted in programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *