FastPrepMinimum Steps on a Circular Letter Dial
Problems/Minimum Steps on a Circular Letter Dial

Minimum Steps on a Circular Letter Dial

IBM logoIBM● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an IBM intern online assessment. The report shows the full movement rule, the function name, the input type and an example. It does not show limits on the numbers.

The uppercase English letters A through Z are arranged in a circle, so A and Z are adjacent.

A pointer starts at A. You may move it clockwise or counterclockwise, and each move to an adjacent letter costs exactly one step.

Given an uppercase string inputStr, visit its characters in order. Return the minimum total number of steps required.

Function

calculateMinSteps(inputStr: String) → int

Examples

Example 1

inputStr = "BZA"return = 4

Move from A to B in 1 step. The shortest route from B to Z is B → A → Z, which costs 2 steps. Finally, move from Z to A in 1 step. The total is 1 + 2 + 1 = 4.

Constraints

  • inputStr contains only uppercase English letters from A through Z.

More IBM Online Assessment questions

  • Missing IntervalsOA · Seen Nov 2026
  • Last Object Exit TimeOA · Seen Nov 2026
  • Count Peaks and ValleysOA · Seen Nov 2026
  • Count Strictly Increasing Contiguous WindowsOA · Seen Nov 2026
  • Total Each Letter's Count in an Encoded StringOA · Seen Nov 2026
  • Count Servers With No Requests in a Time WindowOA · Seen Nov 2026
  • Maximum Easy Tasks After RearrangingOA · Seen Nov 2026
  • Tree Pythagorean TriplesOA · Seen Oct 2026
  • Minimum Power-of-Two Removal OperationsOA · Seen Oct 2026
  • Maximum Compatible Time WindowsOA · Seen Oct 2026

Similar questions at other companies

  • Robot Assembly Line ConflictsGoogle · OA
  • Word Wrap with Even JustificationSentry · OA · PHONE SCREEN
  • Format a Centered Newspaper PageVisa · OA
  • Balance the Game BoardMicrosoft · OA
  • Max Number of OperationsSalesforce · OA
  • Text JustificationUber · PHONE SCREEN
  • Choose the Next Hidden-Word GuessFlexport · ONSITE INTERVIEW
  • Choose the Next Hidden-Word GuessCharacter.AI · PHONE SCREEN
  • URL Segment Compression Part 3 — Global Token BudgetStripe · ONSITE INTERVIEW
  • Branch with the Most FilesCapital One · OA
See IBM hiring insights
Saved
class Solution {
    public int calculateMinSteps(String inputStr) {
      // Write your code here
    }

}
Checking account…