Google | Phone | Return list of output strings after concatenating it with substrings in parentheses
Anonymous User
1110

Given a string x with balanced paranthesis, return list of output strings by adding substring to prefix and suffix

Example:

  1. Input: foo{bar, cat}dog Output: ['foobardog', 'foocatdog']
  2. Input: foo{bar, cat {dog, egg}}baz Output:['foobarbaz', 'foocatdogbaz', 'foocateggbaz']
Comments (6)