FastPrepMinimum Deletions for Unequal Adjacent Characters
Problems/Minimum Deletions for Unequal Adjacent Characters

Minimum Deletions for Unequal Adjacent Characters

IBM logoIBM● EasyFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an IBM online assessment. The report mentions a linear scan for the minimum number of operations. It does not say what the edit operation is or how input is batched. Our version is about 85% the same as the reported question.

You are given an ordered array of printable-ASCII strings. For each string, find the minimum number of character deletions needed so that no two adjacent retained characters are equal. Deletions must preserve the relative order of retained characters.

Return one deletion count per string in input order.

Function

minimumDeletions(strings: String[]) → int[]

Examples

Example 1

strings = ["AABAAB", "AAAA", "ABCD"]return = [2, 3, 0]

The first string needs one deletion from each AA run, the second keeps one of four equal characters, and the third already satisfies the rule.

Example 2

strings = ["", "a", "aabccddd"]return = [0, 0, 4]

Empty and single-character strings need no deletions. The last string deletes one a, one c, and two d characters.

Constraints

  • Every input contains only printable ASCII characters.
  • The total length of all strings is at most 200000.
  • Input order is preserved in the returned counts.

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

  • Maximum Ones After K OperationsGoldman Sachs · OAGoldman Sachs interview questions
  • Minimum Operations to Reduce a Transaction LedgerVisa · OAVisa interview questions
  • Prepare NotificationMicrosoft · OAMicrosoft interview questions
  • Minimum Changes for Distinct Adjacent CharactersHeadlands Technologies · OAHeadlands Technologies interview questions
  • Largest Number With Even Digit FrequenciesDRW · OADRW interview questions
  • Crop Text at a Whole-Word BoundaryAmerican Express · OAAmerican Express interview questions
  • Minimum Flips for Even Binary RunsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Missing WordsVanguard · OAVanguard interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions
  • Smallest String After at Most One DeletionLSEG · OALSEG 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[] minimumDeletions(String[] strings) {
      // write your code here
    }
}
Checking account…