FastPrepFind Minimum Operations
Problems/Find Minimum Operations

Find Minimum Operations

IBM logoIBM● HardOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

A scheduler manages multiple processes with priorities represented by the letters a, b, and c. Its goal is to optimize the schedule to achieve a specific sequence.

The operations available to the scheduler are as follows:

  • Choose a process with priority a, b, or c.
  • Insert the chosen process into the scheduling queue at any position.

Determine the minimum number of scheduling operations required to ensure that the scheduling queue follows the repeating pattern "abc".

Complete the function findMinOperations in the editor below.

findMinOperations takes the following parameters:

  • string s: the scheduling queue

int: the minimum number of operations required to make the queue a concatenation of 'abc' several times

  • 1 ≤ |s| ≤ 10^5
  • s consists only of characters 'a', 'b', and 'c'.

Function

findMinOperations(s: String) → int

Examples

Example 1

s = "abb"return = 3

Transform the queue to abcabc by inserting two letters c and one letter a. The string "abcabc" is the concatenation of "abc" two times.

The minimum number of scheduling operations required is 3.

Example 2

s = "aa"return = 4

Insert 'b' and 'c' after the first and second 'a' to transform the string to abcabc.

Example 3

s = "ac"return = 1

Insert 'b' between 'a' and 'c' to transform the string to abc.

More IBM interview 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
  • Alternate Odd and Even Numbers with Two GoroutinesPHONE SCREEN · Seen Nov 2026
  • Longest Substring Without Repeating CharactersPHONE SCREEN · Seen Nov 2026
  • Maximum Easy Tasks After RearrangingOA · Seen Nov 2026
  • Longest Palindromic SubstringPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
  • Minimum Merge ConflictsAmazon · OA
  • String Formation (Also for AI/ML Software Engineer Intern :)Snowflake · OASnowflake interview questions
  • Longest Subsequence which is a SubstringSalesforce · OASalesforce interview questions
  • Distinct MovesMeesho · OA
  • Compressed Representation SizeMicrosoft · OAMicrosoft interview questions
  • String Challenge (Generic)TikTok · OATikTok interview questions
  • Maximize the Lottery IDCitadel · OACitadel interview questions
  • Sum of All ValuesFlexport · OAFlexport interview questions
  • Maximum Crayon Removal ScoreWells Fargo · OAWells Fargo interview questions

IBM interview experiences

  • IBM Full-Time SWE OA Questions: 1 Experience
  • IBM Software Intern Résumé Rounds: 2 Experiences (Part 3 of 3)
  • IBM Intern Blitz Interviews: 23 Experiences (Part 2 of 3)
  • IBM Software Intern Interviews: 44 Experiences (Part 1 of 3)
  • IBM Software Intern Interview Questions: 15 Experiences
All IBM interview questionsSee IBM hiring insights
Saved
class Solution {
    public int findMinOperations(String s) {
      // write your code here
    }

}
Checking account…