Nov. 27, 2016
Try to post the first code review on code review on stack exchange, code review section.
When I try to put the title:
Leetcode 329 Longest Increasing Path in a matrix - DFS, memorization
Here are information coming out.
Questions that may already have your answer
Review the above entries.
So many to read and so good the experience is. Cannot wait to spend time on those posts. Julia knows that it is time to make changes, her research usual touched the surface only.
For example, with stackexchange code review, her research from Nov. 30 posting the question to a perfect solution (Dec. 2, 2016) on Java TreeSet class floor method and its analog in C# ends up working code - SortedSet GetViewBetween, score maximum score. It takes less than 3 days to find a practical solution, with two experts' help.
Blog reading:
Bear and steady gene - C# algorithm:
https://gist.github.com/jianminchen/153eab0defae014842e8
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.
Showing posts with label TreeSet. Show all posts
Showing posts with label TreeSet. Show all posts
Sunday, November 27, 2016
Sunday, November 20, 2016
Woman's CodeSprint 2 - Minimum Loss - after the contest (series 2 of 10)
Nov. 20, 2016
Julia worked on the algorithm in the contest, and then solved the algorithm with full score - 35.
Here is the problem statement:
Julia's C# solution:
The ideas used in the algorithm:
Use bucket sort similar idea to go through each bucket, compare to previous if the current is less than minimum loss
or not. Each bucket keeps the two value - max/ min value.
Study all other submissions using C++, Java, C#, JavaScript:
Actionable Items:
1. Read the code line by line, word by word; train myself to understand the code, by reading, by association
with C#.
2. Study TreeSet - Java - class - memorize all the API, compared to C# Hashset
https://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.htmlMy favorite Java code:
https://gist.github.com/jianminchen/3fce12eff5838fa10bff0792547d0779
A small research - TreeSet in Java is implemented as Binary search Tree?
http://stackoverflow.com/questions/4430809/making-binary-search-tree
Find the best solution written in Java:
Discussion of Time Complexity:
1. Brute force solution - O(n^2), choose any two year to compare the price. Will time-out!
2. Using Binary search - therefore, it is easy to find the minimum price, O(nlogn)
Maintain a binary search tree!
Study this C# solution using Binary search tree:
https://gist.github.com/jianminchen/c910f5d1f37309c70b489e6c75b0678c
line 16, 25 are Julia's favorite code -
Very classical solution using binary search tree, and very clever solution.
Memorize the solution. Warm up the solution sometimes in the future.
Subscribe to:
Posts (Atom)