Back to problems

Solve three coding interview problems

Algorithm · Google · Hard

1) Given an encoded string s, reconstruct its full text. A substring with the form k[body] means that body must be repeated exactly k times. The multiplier k is a positive whole number and may contain multiple digits. Encoded blocks may be nested inside other encoded blocks. Return the completely decoded string. Example 1: Explanation: The inner 3[cd] becomes "cdcdcd"; the outer multiplier then repeats "abcdcdcd" twice. Example 2: Explanation: 2[a] expands to "aa", so each…

Checking your access…