Ezvor

3846. Total Distance to Type a String Using One Finger

MediumHash Table Preparing judge… LeetCode
Hash TableString

Hints

Hint 1
Map each character to its (row, col) position on the keyboard grid.
Hint 2
Start from the position of 'a' and process the string from left to right.
Hint 3
For each move, add the Manhattan distance abs(r1 - r2) + abs(c1 - c2) between consecutive keys.
Hint 4
Accumulate the total distance and return the sum.