Repeatedly Add Consecutive Equal Digits

Problem Overview

  • Given a string of digits, repeatedly replace each run of consecutive equal digits with the sum of that run until no adjacent digits are equal; return the final string.
  • Input: digit-only string. Output: transformed digit string. Sums can be multi-digit; iterate until stability (no repeats).
  • Domain: string processing and iterative aggregation in numeric text data.
  • From Uber interviews; a coding interview problem often used as an 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: