Skip to content

Practice Minimum Time to Type Word Using Special Typewriter

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1974
LeetCode Problem

Minimum Time to Type Word Using Special Typewriter

Problem Statement

The letters a through z lie in alphabetical order around a circle, with z next to a. The pointer starts at a. Each second, either move it one letter clockwise or counterclockwise, or type the letter currently under it. Return the minimum seconds required to type word in order.

Source: Minimum Time to Type Word Using Special Typewriter on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
word = "abc"
Output
5

# Example 2

Input
word = "bza"
Output
7

# Example 3

Input
word = "zjpc"
Output
34

Constraints

1 <= word.length <= 100
word consists of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Minimum Time to Type Word Using Special Typewriter.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.