Had my google phone screen on Jan 13th for Google Banglore L4.
Interviewer was from Zurich and asked a simple question. Given a string with +, - and parenthesis(only 1 level deep) , we need to simplify the expression.
a+b+a+c-b-b-b+(d+c) => 2a-2b+2c+d
Did a single pass solution while keeping a flag to track "-(" , Used the flag to check each operand sign and added to hashmap, later traversed the hashmap to print each single variable with count.
Missed to print '+' in the last string , as i only thought of to_string on negative operations. As time was over did not get to dry run my code aswell.
Interviewer mentioned me to add a comment //Need to address '+' addition in result
Above the line where the check needs to happen.
Havent heard back from the recruiter as of now..
Do I stand a chance ?
Update: Profile was not shortlisted.