Tuesday, April 3, 2018

Leetcode 282: Expression Add Operators

April 3, 2018

Introduction


It is hard level algorithm. I like to study the algorithm so I searched the discussion panel. I found one link with very good comment, here is the link.


Code study


I like to prepare an algorithm for my 10:00 PM mock interview as an interviewer. I like to try a new algorithm, and also I like to learn quickly through the mock interview as well. Now it is 9:29 PM.

First, I have to understand how to handle multiplication. Here is the link to give out the explanation.

If you want to add a * between 3 and 4, you would take 3 as the digit to be multiplied, so you want to take it out from the existing eval. You have 1 + 2 + 3 * 4 and the eval now is (1 + 2 + 3) - 3 + (3 * 4).


No comments:

Post a Comment