Microsoft Interview Question

Implement the string operation execution process used in calculators

Interview Answer

Anonymous

Feb 8, 2020

With this question, I remembered high school mathematic acronym BODMAS for executing mathematic operation. I tried implementing this process using a couple of approaches but it didn't work, I tried stacks, recursion, etc but it didn't work, the interviewer tried giving me some hints but I couldn't still get it work in my algorithm. Then when time was over, the interviewer looked at me and smiled while saying I was on tracked but missed some steps. I knew I was to solve this problem using a stack but I was missing something. Then I realized the problem was what I had established before. The computer doesn't directly follow BODMAS. In the computer world, * and / have the same precedence and are the highest while + and - have the same and are the lowest. This was what I missed at the beginning which played on me till the end. So this session ended without me coding the algorithm because I didn't have it right but my interviewer loved it because it was full of a lot interactions and struggles. He actually saw me not giving up even though some things I was saying was not making any sensešŸ˜‚ I wanted to so bad solve this question. One could see the burning desire on my face to get it solve . I struggled till they told me time up 😁