Google | Software Engineer L3
Anonymous User
3058

String substitution

You have given HashMap with keys and its values
Hashmap
user - Alex.
city - Seattle.
month - September

substitute the variable of the string, and the variable in the string starts and end with character #.

String find = "mynameis#user#livesin#city#month".

String substituteString(String find) {
}

o/p would be of the above string find - mynameisAlexlivesinSeattlemonth

I had solved this using stack and traverse the string from the back, don't know whether it was correct or not.

Comments (12)