Recently I was contacted by google recruiter on linkedin and we sceduled for technical phone interview.
Question:
Given some names and their values. Write a function which takes name as input and outputs full value, also replacing the name in the value if present.
AXA = '/leetcode/config'
BYB = '/%AXA%/interview/corner/file'
LCLS = '/tmp/file/usr/shared/%BYB%'
Input: BYB
Output: '/leetcode/config/interview/corner/file'
Input: LCLS
Output: '/tmp/file/usr/shared/leetcode/config/interview/corner/file'I gave solution close to needle/haystack problem, also saving data in hash table. But I would like to know if someone can think of a better approach to solve this.