Google Interview Question Onsite
Anonymous User
692

Given a string which contains placeholders, substitue them with the values.

value_map = 
{
  "V1": "Hello",
  "V2": "$V1",
  "V3": "Hola $V2"
}
input string: Sky $V1 $V2 $V3

output: Sky Hello Hello Hola Hello

note: nesting can be very deep 

I wasnt able to code this perfectly as at first I just programmed for no nestedness.

Comments (6)