Preparing for an interview? Check out Cracking the Coding Interview
Published on

Google | L4 | Phone screen

Author
  • Shared Anonymously

The question was

evaluate the string  
add(2,mul(div(2,sub(5,1)),pow(2,3)))  

For first 20 minutes interviewer kept on asking questions like, how would you solve if numbers could be in decimals, or negative power.First, i explained the complete recursive solution approach.

Then i got a stack approach with O(n) time,I hinted that there is a solution possible with stacks having less time complexity. but he insisted to write the code with recursive approach pointing that 20 minutes had passed.
i was able to write the complete code in time.
but feedback came to be, inefficient coding.

I wonder how differently should the interview have gone.
Should I have insisted to explain stack approach?
Should I have started directly with optimal approach only?
Could it be the case that only 1 quesion was solved though he might have 2 quesions with him?
The code was correct but, I found it difficult toexplain the dry run also, because i took a bigger example to run. Could dry run be important factor?

or please help with any other tip you would like to give.

ReportMark as Helpful