April 9, 2016
Julia likes to have some adventure and just get into other people's solution, and quickly learn something in next 20 - 30 minutes.
Problem statement:
Statistics: time spent: 11:22am - 1:00pm
Here is the solution from a programmer working in Apple:
Code to study by Apple engineer
Comments after reading:
1. This problem is about DFA, NDFA, those content learning in Formal Language, how to build a compiler.
Friendly remind - great time to study formal language, first time for computer science master degree, score C in the course, and then in 2001 to prepare Ph.D. qualification example, Julia spent a lot of time to read the textbook again.
2. The string parsing is more complicate, '(', ')' should be treated as operator, and then, you can build up something.
3. Read the wiki webpage to quickly refresh knowledge
https://en.wikipedia.org/wiki/Deterministic_finite_automaton
4. Play with Visual studio and also the code - debug and run through the test case 20-30 minutes:
(ab)|(ba) 2
((a|b)*) 5
5. And put some diagram on the paper, take picture, post here and see if you can draw the state diagram for this machine. ( 20 - 30 minutes)
Julia likes to read the code, and also debug the code;
Some facts:
1. she learned Formal language in 2001 to prepare Ph.D. qualification exam, but she never did spend time to work on an concrete example, debug the code to see how it is designed.
2. the code is well designed, and also beautiful code to read;
It is hard to figure out how to construct the Ndfa, but reading the code, Julia, you should figure out the design:
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.
No comments:
Post a Comment