Practice Count Number of Texts
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
The phone keys map 2 to abc, 3 to def, 4 to ghi, 5 to jkl, 6 to mno, 7 to pqrs, 8 to tuv and 9 to wxyz. A letter is entered by pressing its key as many times as its one-based position in that group. Given the concatenated pressedKeys without letter boundaries, count the possible original text messages modulo 10^9 + 7. Digits 0 and 1 are unused.
Source: Count Number of Texts on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
pressedKeys = "22233"
8
# Example 2
pressedKeys = "222222222222222222222222222222222222"
82876089
Constraints
Related LeetCode Problems
Practice more problems similar to Count Number of Texts.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.