Array Burst problem

Company: Goldman Sachs_30oct

Difficulty: medium

Problem Statement

Array Burst problem Problem Description You are given an array of single-character strings, inputArr , and a positive integer burstLength . A run is a maximal block of equal elements sitting next to each other -- maximal meaning it cannot be extended to the left or to the right without meeting a different element. A run bursts when its length is at least burstLength , and bursting removes the whole run, however long it is, not just burstLength of its elements. Removing a run pulls what was on its left up against what was on its right. Those two pieces may now be equal, forming a longer run that bursts in its turn, and that may set off another collapse behind it. Keep bursting until no run of length burstLength or more is left anywhere in the array. Return what remains. The order of the surviving elements never changes. Input Format A single line, written exactly like the examples: inputArr = ["a", "b", "c"], burstLength = 2 That is, the literal text inputArr = , then the array as a bra