Ad
  • Default User Avatar

    Thanks for looking at my solution and giving some feedback!

    I agree that it might be overkill for the problem as stated. But when time permits, I always try to go for the solution that is easiest to maintain/update over time (e.g. low code churn, only having to make changes in one spot).

    The lambda isn't really required for my solution. I could just hard code it to 2 and then update it if new operators are ever added. But then again, that violates my goal of only having to make a change in one spot.

    The stringstream I thought was the fastest way of doing string concatenation, but Google searching shows that I'm probably wrong. So I could easily have just used a string instead.

    The precedence offset was simply my way of handling parentheses (especially nested parentheses). Too bad it looked like a jigsaw puzzle. I strive for readability as well.