No Pairs Allowed

Problem Overview

  • For each word, find the minimum substitutions so no adjacent characters are equal.
  • Input: array of lowercase strings; Output: array of integers per word; 1 ≤ n ≤ 100, 2 ≤ |word| ≤ 100000.
  • Context: string processing/text normalization to prevent consecutive duplicates in text.
  • From Palantir interviews; a common coding interview problem and interview question.

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: