Back to course home
0% completed
Solution: Minimum Time to Type Word Using Special Typewriter
Problem Statement
You are given a circular keyboard
that has all the lowercase
English letters ('a' to 'z') laid out in a circle. You can type a particular character if the point is pointed to that character. Initially, a cursor points at the letter 'a'.
At each second, you can perform the following operation:
Move the cursor
eitherone step
to theleft
orright
.- Type the letter where the pointer points currently.
Given a string word
, return the minimum
number of seconds to type out the characters in a word.
Examples
- Example 1:
- Input:
"bad"
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible