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