Algorithm · Waymo · Hard
Requirements Input: a string containing ordinary characters, groups enclosed in parentheses, and trailing {k} repeat markers that apply to the group immediately before them. Groups may be nested. For instance, "x(y(z){3}){2}" decodes to "xyzzzyzzz". Output: return the completely decoded string. Example: "pq(rs){2}t" → "pqrsrst". Notes Important cases to cover include: k = 0, which removes that group; a ) not followed by {...}, which means the group is used once; repeat…
Checking your access…