| 1 | int minimumKeypadClickCount(string input) |
| 2 | { |
| 3 | char right[9][3] = { |
| 4 | {'a', 'j', 's'}, |
| 5 | {'b', 'o', 't'}, |
| 6 | {'c', 'p', 'u'}, |
| 7 | {'d', 'k', 'v'}, |
| 8 | {'h', 'm', 'z'}, |
| 9 | {'g', 'l', '@'}, |
| 10 | {'e', 'n', 'w'}, |
| 11 | {'f', 'q', 'x'}, |
| 12 | {'i', 'r', 'y'}}; |
| 13 | int n, count1 = 0, count2 = 0; |
| 14 | n = input.length(); |
| 15 | for (int i = 0; i < n; i++) |
| 16 | { |
| 17 | int d = input[i] - 97; |
| 18 | d = d % 3; |
| 19 | count1 += (d + 1); |
| 20 | } |
| 21 | for (int i = 0; i < n; i++) |
| 22 | { |
| 23 | for (int j = 0; j < 9; j++) |
| 24 | { |
| 25 | for (int k = 0; k < 3; k++) |
| 26 | { |
| 27 | if (right[j][k] == input[i]) |
| 28 | { |
| 29 | count2 += (k + 1); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | return count2; |
| 35 | |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected