Ad
  • Custom User Avatar

    I tried both solutions (numeric and with string) and the string seems to be 10 times slower than the numeric one. But could be my setup. Still your explanation was pretty good.

  • Default User Avatar

    Thanks for the heads up! I've recoded it to check balance as well as counts. :)

  • 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.

  • Default User Avatar

    Strictly speaking maybe it's not another place but 949 guys passed the kata so I can't change it. Do you have a better description?