Google Onsite

Anonymous User
769
Jan 03, 2025

Got a question similar to this in one of the rounds. What are some good approaches for this...

Write a tool which supports substitutions of templates by other strings. Example:

Ex. 1
Given {"X" -> "123", "Y" -> "456", "Z" -> "abc"}
Then "%X%_%Y%" should be resolved to "123_456"


Ex. 2
Given {"X" -> "123", "Y" -> "456", "Z" -> "abc%Y%"}
Then "%X%_%Y%_%Z%" should be resolved to "123_456_abc456"
Comments (10)