FastPrepRecursively Sum Identical Digit Runs
Problems/Recursively Sum Identical Digit Runs

Recursively Sum Identical Digit Runs

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes maximal runs of the same digit, replacing each run with digit times run length, recursive processing of new neighbors, and 66644319333 turning into 26328. We supplied limits and a function signature.

Given a decimal digit string, replace every maximal repeated-digit run by the decimal representation of digit × run length. Single-character runs remain that digit.

Repeat whole passes when a replacement creates adjacent equal digits, stopping when all adjacent digits differ. Return the final string.

Function

compressDigitRuns(digits: String) → String

Examples

Example 1

digits = "66644319333"return = "26328"

Repeated passes collapse the newly adjacent digits until no equal neighbors remain.

Example 2

digits = "123"return = "123"

No run needs replacement.

Constraints

  • 1 <= digits.length <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Reliable LLM Call with Independent Retry BudgetsStripe · OAStripe interview questions
  • Tennis Game ScoreAbridge · OAAbridge interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Robot Assembly Line ConflictsGoogle · OAGoogle interview questions
  • Parcel Event TrackingAirbnb · OAAirbnb interview questions
  • Repair One Movement InstructionOpenAI · OAOpenAI interview questions
  • Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
  • Format TextTikTok · OATikTok interview questions
  • Binary String Swap TimeMicrosoft · OAMicrosoft interview questions
  • Communications HandlerAkuna Capital · OAAkuna Capital interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String compressDigitRuns(String digits) {
        // Write your code here.
    }

}
Checking account…