LeetCode --- 1974. Minimum Time to Type Word Using Special Typewriter 解题报告

Question:

There is a special typewriter with lowercase English letters 'a' to 'z' arranged in a circle with a pointer. A character can only be typed if the pointer is pointing to that character. The pointer is initially pointing to the character 'a'.

LeetCode --- 1974. Minimum Time to Type Word Using Special Typewriter 解题报告_第1张图片

Each second, you may perform one of the following operations:

  • Move the pointer one character counterclockwise or clockwise.
  • Type the character the pointer is currently on.

Given a string word, return the minimum number of seconds to type out

你可能感兴趣的:(Python,算法,LeetCode,leetcode,算法,python,数据结构,面试)