Quick Overview

Repeatedly remove adjacent runs of k equal characters until no further cascade is possible. Use a stack of character counts for linear time, handling long runs, complete removal, empty input, and the k = 2 special case.

Remove Adjacent Duplicate Runs of Length K

Company: Attentive

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Repeatedly remove adjacent runs of k equal characters until no further cascade is possible. Use a stack of character counts for linear time, handling long runs, complete removal, empty input, and the k = 2 special case.

Loading…