17.Letter-Combinations-of-a-Phone-Number
17. Letter Combinations of a Phone Number
题目地址
https://leetcode.com/problems/letter-combinations-of-a-phone-number/
https://www.jiuzhang.com/solutions/palindrome-partitioning-ii/
题目描述
代码
Approach 1: Backtracking
Complexity Analysis
Time complexity : O(3^N×4^M) where
N
is the number of digits in the input that maps to 3 letters (e.g.2, 3, 4, 5, 6, 8
) andM
is the number of digits in the input that maps to 4 letters (e.g.7, 9
), andN+M
is the total number digits in the input.Space complexity : O(3^N×4^M) since one has to keep 3^N×4^M solutions.
Last updated