Showing posts with label code study: Leetcode blogs. Show all posts
Showing posts with label code study: Leetcode blogs. Show all posts

Thursday, August 25, 2016

Code study: Leetcode blogs

August 25, 2016

 Compile a list of Leetcode blogs to read, 10 minutes a time, look for excellence through blogs:

1. http://bangbingsyb.blogspot.ca/   (Microsoft, C++)
2. http://fisherlei.blogspot.ca/          (facebook, blogs, C++)

C++ solutions in github:
1. https://github.com/jianminchen/leetcode-1 (C++, ex-amazoner)
2. https://github.com/liaoxl/leetcode/tree/master/code  (Neteaze, C++, China)
3. https://github.com/jianminchen/Leetcode-13  (UBC, C++)
4. https://github.com/jianminchen/myleetcode (China, Microsoft, C++)
5. https://github.com/jianminchen/LeetCode-IIII  (C++, HackerRank Silver medal)
6. Inside github, search HackerRank, find this: (MSFT, top performer, with time spent for each algorithm)
https://github.com/jianminchen/LeetCode-17

Java solutions in github:
1.  https://github.com/jianminchen/LeetCode-Java-Solutions
2.  https://github.com/jianminchen/LeetCode-Java-Solutions  (Java, computer PH.D.)
3.  https://github.com/jianminchen/LeetCode-Sol-Res  (Nine chapter etc., Java)
4.  https://github.com/jianminchen/leetcode-3   (Java solution, Googler)

C# solution:
1. https://github.com/jianminchen/LeetSharp
2. https://github.com/jianminchen/Qilu-leetcode
2. https://github.com/jianminchen/LeetCodeInCSharp
Motivation talk: 
1. Sometime, google, bing search do not provide best source code, so, it is time to look up github forked solutions. 

Friendly remind: 
Julia, you should use github's search - use keyword: Leetcode to find solutions - 

2. Look for optimal solution, do not miss the best solution in practice of Leetcode algorithm. Do not rush, try to go through all kinds of practices, search for great ideas out there. Get the best idea to practice. One algorithm a time. 

3. Follow more people through github, easy to fork leetcode solutions. Sometimes, it is hard to tell best code, just get some code running first, write first C# practice, and then, ideas will come, what to search, issues etc.

4. Evaluate practices (junior/middle/senior level practice), and then compare to 5-10 practices. (0-3 junior practice, 4-7 middle level, 1-2 optimal solution, senior level practice)

4. Look up stackoverflow to get more ideas, specially from high reputation/ high voted opinions, terms to know when practicing Leetcode algorithms. Try to expand the things to work on through the practice, one algorithm can bring good study about coding style. See the blog:
http://juliachencoding.blogspot.ca/2016/08/leetcode-125-valid-palindrome-summary.html


5. When practicing Leetcode questions, try to work on more through the practice. There is an idea that if you work on thoroughly on one problem a time, you may be able to solve unseen problems as well.

Actionable Items:

1. Study programming principles:
Programming principles
https://github.com/jianminchen/programming-principles









Sunday, August 14, 2016

Microsoft Development Service - watch and learn

August 14, 2016

 Great time to watch and learn. First thing in the Sunday morning is to relax and learn.

Blogs to read:
http://stories.visualstudio.com/bing-continuous-delivery/

Videos:

1. Full Keynote: The Future of Microsoft Tools and Services for the New Role of Developers
https://www.youtube.com/watch?v=Gks7Ngzt5Yw

2. Keynote: Visual Studio 2015 - Any App, Any Developer
https://www.youtube.com/watch?v=Nj1luMpj7mI

Blogs to read:

1. Leetcode 380: (code study: Leetcode blogs)
http://www.guoting.org/leetcode/leetcode-380-insert-delete-getrandom-o1/

2. Leetcode 380 - Insert Delete GetRandom O(1)
https://leetcode.com/problems/insert-delete-getrandom-o1/

3. Read the article
http://www.programcreek.com/2014/08/leetcode-insert-delete-getrandom-o1-java/

4. Read Uber map article:
http://goo.gl/nmRv18

Google search keyword:
red-black tree - C++ implements the map

2.
https://goo.gl/fWq132

Thursday, August 4, 2016

ITINT5: tree maximum path sum (II)

August 4, 2016

Blog 1: July 6, 2015
http://juliachencoding.blogspot.ca/2015/07/itint5-tree-maximum-path-sum.html

First writing in C# (July 6, 2015)
https://gist.github.com/jianminchen/754d29e47c491cfc271f764fb5dd8a61

Review comments (August 4, 2016, after 13 months):
1. first, the input argument res - variable name - not accurate - res should be maxValueCrossRoot
2. function name: maxTreePathSumRe is confusing, will be better called "maxTreePathSumEndByRoot"
3. line 121, 122 can be merged into one line statement - easy to read 
4. add some design spec for the function - maxTreePathSumRe

Blog 2: August 4, 2016
C# code practice: 2nd writing
https://gist.github.com/jianminchen/c9be400e7bee71734ee7c454635846cf

review comments:
1. Line 138 - 150, function ArrayMaximum
No need, call Array.Max();

3rd writing:
https://gist.github.com/jianminchen/3b2c8e0e84e52cbca2a7ec435b29a2e4

highlight of changes:
1. line 124, use Array.Max(), remove the function: ArrayMaximum(int[])

Use Language Integrated Query (LINQ) - Array.Max(), detail see the blog:
http://juliachencoding.blogspot.ca/2016/06/array-class-c-c-javascript-java.html

LINQ - Enumerable Methods Reference:
https://msdn.microsoft.com/en-us/library/bb342261(v=vs.100).aspx

Blogs to read:
Choose topic: extended merge sort
Algorithm: count inversions

count inversions - extended merge sort
1. http://jane4532.blogspot.ca/2013/06/zz-google-onsite-interview.html
2. http://www.geeksforgeeks.org/counting-inversions/
3. http://www.cs.umd.edu/class/fall2009/cmsc451/lectures/Lec08-inversions.pdf
4. https://www.cp.eng.chula.ac.th/~piak/teaching/algo/algo2008/count-inv.htm