April 26, 2016
To master this DFS algorithm, Julia likes to do more practice. Every time she practices, she finds new issue, new concern. She also knows that to memorize a solution is not a good idea, do not focus on what you remember about the algorithm, even you have some memory about the algorithm and solution. You may have to solve a totally different problem.
Leetcode 17 phone number combination
Review the blog:
http://juliachencoding.blogspot.ca/2016/01/leetcode-17-letter-combinations-of.html
One more practice - write the code using the same idea, still makes a bug, and learn how to do fast coding, add more explanation variable, and temporary variable.
https://gist.github.com/jianminchen/acbbf5fbd5fefa1a9fb2f7b3664bf4ed
https://gist.github.com/jianminchen/90ac4390929704ce439d0a1f255f4546
Make function more flat, close to left side, more readable - remove if/ else statement in the function, more flat; also, more readable code, less chance to have a bug.
https://gist.github.com/jianminchen/b866a5c331556ea8f36aecfe123befea
Reading:
https://msdn.microsoft.com/en-us/library/zcbcf4ta.aspx
http://geekswithblogs.net/robp/archive/2008/08/13/speedy-c-part-3-understanding-memory-references-pinned-objects-and.aspx
Question and Answer:
Julia has some concerns about recursive function, she will find some articles to read:
1. General about stack, recursive function.
2. How to check using C# - recursive argument one copy or its own copy?
3. Play safe, use extra variable to save the value.
No comments:
Post a Comment