Minimal Operations

Problem Overview

  • Given words, find the minimum substitutions per word so no adjacent characters are equal.
  • Input: array of lowercase strings. Output: array of integers with minimal substitutions. n ≤ 100, word length 2–1e5.
  • Applies to text processing or data cleaning to avoid repeated adjacent letters.
  • Asked in Salesforce interviews; a string manipulation interview question for coding interview problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: