April 9, 2016
Problem statement
Category: Difficult problem
Spend 25 minutes to think about problem, and then will get into other people's submission, and see what should be learned.
10:30 am - 10:55 am
Spent 25 minutes to think about the problem.
Try to express the expression using binary tree, like 1 + 2 * 3 problem using a tree.
So, ab can be express as a tree:
operator .
/ \
a b
a|b
operator |
/ \
a b
a*
put * as parent node, and a is left child of operator node *
(a*)5
put 5 as the parent node of operator *
Structure the input as tree structure, and then, define different class - concatOp, orOp, starOp
Read the expression from left to right, and then, put it into data structure like a stack, and then, parse it, store it in the binary tree.
April 10, 2016 2:32 pm
This is a graph problem, and also, the NFA, DFA problem. Julia, you are lucky to review the problem. Spend some time in the short future to go over code, give yourself a graph coding experience.
From January 2015, she started to practice leetcode questions; she trains herself to stay focus, develops "muscle" memory when she practices those questions one by one. 2015年初, Julia开始参与做Leetcode, 开通自己第一个博客. 刷Leet code的题目, 她看了很多的代码, 每个人那学一点, 也开通Github, 发表自己的代码, 尝试写自己的一些体会. She learns from her favorite sports – tennis, 10,000 serves practice builds up good memory for a great serve. Just keep going. Hard work beats talent when talent fails to work hard.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment