Google Onsite

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-01-03Added By Anonymous
Source: Link

Company: Google
Role: unknown
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

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