Find Minimum Keypad Click Count (AMZ CN) π₯
Learn this problemProblem statement
A recently launched supplemental typing keypad gained significant popularity on Amazon Shopping due to its flexibility.
This keypad can be connected to any electronic device and has 9 buttons, where each button can have up to 3 lowercase English letters. The buyer has the freedom to choose which letters to place on a button while ensuring that the arrangement is valid. A keypad design is said to be valid if:
Examples of some valid keypad designs are:
1 2 3
abc def ghi
4 5 6
jkl mno pqr
7 8 9
stu vwx yz
1 2 3
ajs bot cpu
4 5 6
dkv hmz gl
7 8 9
enw fqx iry
In the left keypad, "hello" can be typed using the following button presses:
Thus, total num of button presses = 2 + 2 + 3 + 3 + 3 = 13.
In the right keypad, "hello" can be typed using the following button presses:
Thus, the total num of button presses = 1 + 1 + 2 + 2 + 2 = 8.
The keypad click count is defined as the number of button presses required to print a given string. In order to send messages faster, customers tend to seek the keypad design in such a way that the keypad click count is minimized while maintaining its validity.
Given a string letters consisting of lowercase English letters only, find the minimum Keypad click count.
Function
findMinimumKeypadClickCount(letters: String) β intExamples
Example 1
letters = "abacadefghibj"return = 14
1 2 3
ajs bkt clu
4 5 6
dmv enw fox
7 8 9
gpy hqz ir
Here, the keypad click count = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 2 = 14.Constraints
An unknwon urban myth for now lolMore Amazon problems
- Resolve Task DependenciesONSITE INTERVIEW Β· Seen Jul 2026
- Shortest Distance on a Circular Bus RouteOA Β· Seen Jul 2026
- Longest Increasing Subsequence With Bounded Adjacent DifferenceONSITE INTERVIEW Β· Seen Jul 2026
- Search in a Rotated Sorted ArrayONSITE INTERVIEW Β· Seen Jul 2026
- Sliding Window MaximumONSITE INTERVIEW Β· Seen Jul 2026
- Merge IntervalsOA Β· Seen Jul 2026
- Sort Bug Report FrequenciesOA Β· Seen Jul 2026
- Drone Delivery RouteOA Β· Seen Jul 2026