# Letter Combinations of a Phone Number

```python
class Solution:
    def letterCombinations(self, nums):
        """
        :type nums: str
        :rtype: List[str]
        """
        self.dict = {
            '1': '*',
            '2': 'abc',
            '3': 'def',
            '4': 'ghi',
            '5': 'jkl',
            '6': 'mno',
            '7': 'qprs',
            '8': 'tuv',
            '9': 'wxyz',
            '0': ' '
        }
        if not nums: return []
        self.res = []
        self.dfs(nums, "", 0)
        return self.res
    
    def dfs(self, nums, path, index):     
        if len(path) == len(nums):
            self.res.append(path)
            return
        else:
            for c in self.dict[nums[index]]:
                self.dfs(nums, path+c, index+1) 
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zcjian.gitbook.io/project/backtracking/letter-combinations-of-a-phone-number.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
