First Onsite round
Given variable values such as x = "new"
y= "%xworld"
z="hello"
example resolveString("%z_%x_%y_world")
output: hello_new_newworld_world
then there will other function which will resolve the input string and return something like string resolveString(string input)
there will be another function to update vars value updateVariable(char var, string value)
Implement both these functions.
Second Onsite Round
Given an array { 1, 7, 7, 2,3, 7, 6,-20}. Find the longest nondecreasing contiguous sequence with substitution. we can substitute any array element with any integer such as all occurences of 7 replaced with 1. In this way new array would be { 1,1,1,2,3,1,6,-20}.
Only one substitution is allowed.
Third Onsite Round
Implementation of circular buffer.
Follow up : multiple threads trying to read and write to buffer. how would I handle such cases of concurrency.
Hope this experience helps.