Sunday, June 12, 2016

Array Class - C#, C++, JavaScript, Java

June 12, 2016

Memorize all API of array definitely will help performance, help to communicate and fast coding. Just invest time to read, memorize, and practice. More reading leads great coding experience.

Ask questions about design, why they share the same, what is difference. So, like bible verse, you will come out the API just in second when you have a problem to solve.

A small research about good programmer vs good googler:
http://juliachencoding.blogspot.ca/2016/06/good-programmer-or-just-good-googler.html

So, Julia starts to go over all API of Array class first:

in C#: (once a week, spend 30 minutes to go over all examples, memorize them all!)

https://msdn.microsoft.com/en-us/library/system.array(v=vs.110).aspx

It is an abstract class Array, implementing 6 interfaces:
   IConeable,
   IList,
   ICollection,
   IEnumerable,
   IStructuralComparable,
   IStructuralEquatable

Property:
IsFixedSize
IsReadOnly
IsSynchronize
Length
LongLength
Rank
SyncRoot

C# array method:
https://msdn.microsoft.com/en-us/library/system.array_methods(v=vs.110).aspx

40 methods:  (June 16, 2016, Go over them one by one, mark favorite ones)

AsReadOnly(T) (20 minutes June 19, 2016)
BinarySearch
Clear
Clone
ConstrainedCopy
ConvertAll
Copy
CopyTo
CreateInstance
Empty(T)


Exists(T)
Find(T)
FindAll(T)
FindIndex
FindLast(T)
FindLastIndex
ForEach(T)
GetEnumerator
GetLength
GetLongLength

GetLowerBound
GetUpperBound
GetValue
IndexOf
Initialize
LastIndexOf
Resize(T)
Reverse
SetValue
IList.Add

IList.Clear
IList.Contains
IList.IndexOf
IList.Insert
IList.Remove
IList.RemoveAt
IStructuralComparable.CompareTo
IStructuralEquatable.Equals
IStructuralEquatable.GetHashCode
TrueForAll(T)

Have to work on Enumerable 50 methods first:

System.Linq > Enumerable Class > Enumerable 50 Methods:

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

Aggregate
All(TSource)
Any
AsEnumerable(TSource)
Average
Cast(TResult)
Concat(TSource)
Contains
Count
DefaultIfEmpty

Distinct
ElementAt(TSource)
ElementAtOrDefault(TSource)
Empty(TResult)
Except
First
FirstOrDefault
GroupBy
GroupJoin
Intersect

Join
Last
LastOrDefault
LongCount
Max
Min
OfType(TResult)
OrderBy
OrderByDescending
Range

Repeat(TResult)
Reverse(TSource)
Select
SelectMany
SequenceEqual
Single
SingleOrDefault
Skip(TSource)
SkpWhile
Sum

Take(TSource)
TakeWhile
ThenBy
ThenByDescending
ToArray(TSource)
ToDictionary
ToList(TSource)
ToLookup
Union
Where

JavaScript 
http://www.w3schools.com/jsref/jsref_obj_array.asp
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype (June 14, 2016 - go over 2 hours)
Array Methods - 25 methods

concat
copyWithin
every
fill
filter
findIndex
forEach
indexOf
isArray
join


lastIndexOf
map
pop
push
reduce
reduceRight
reverse
shift
slice
some


sort
splice
toString
unshift
valueOf


Study on June 13, 2016:
copyWithin - 3 arguments, target, start (required), end(required) (optional)

You should not use an array as associative arrays

http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from

Study:
compare to JavaScript Set object
Set

https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set

Map

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map


JavaScript reference:

https://msdn.microsoft.com/en-us/library/yek4tbz0(v=vs.94).aspx

Array object:
https://msdn.microsoft.com/en-us/library/k4h76zbx(v=vs.94).aspx

JavaScript array study:  June 30, 2016

PROPERTY:
3 properties:

constructor,
length
prototype




constructor property:
https://msdn.microsoft.com/en-us/library/jj155291(v=vs.94).aspx


length:

array is sparse, so the array is not contiguous. The length is not necessarily the number of elements in the array.
https://msdn.microsoft.com/en-us/library/d8ez24f2(v=vs.94).aspx


Prototype:

https://msdn.microsoft.com/en-us/library/jj155285(v=vs.94).aspx


JavaScript array 29 methods:

Spend 10 minutes a time to memorize all the function names, and then, try to guess each api's task, what are the arguments, how it is designed.

write down:
Array.from   - copy array from, input argument is array.
isArray      - Array.isArray(arr)  input argument arr is array
of           - ? wild guess -
concat       - arr1.concat(arr2), concatenate the string
entries      - entries  - arguments: startIndex, endIndex, return subarray?

every        - iterator - go through each node in the array to check some logic?
fill         - fill - arr.fill(1), all the elements in the array are assigned to the same value
filter  
findIndex
foreach

indexof
join
keys
lastIndexOf
map

pop
push
reduce
reduceRight
reverse

shift
slice
some
sort
splice

toString
unshift
valueOf
values

challenges:
  Arguments:
  callback funciton -

  callback function syntax

  3 things Julia likes the JavaScript Array.fill function design:
   - start, end arguments are options
   - negative start, end arguments handling
   -
 
-- end of June 30, 2016 study --
-- End of JavaScript --

-----     Java ---
Java Array reference:
https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Array.html

Java Array

Method inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait

Method detail:
Array.newInstance

getLength
get  - Array.get(array, index)

getBoolean - Array.getBoolean(array, index)

getByte - Array.getByte(array, index)

getChar - Array.getChar(array, index)


getShort - Array.getShort(arrray, index)

getInt
getLong
getFloat
getDouble

set - Array.set(array, index, Object value)

setBoolean
setByte
setChar   - Array (Object array, int index, char c)
setShort
setInt
setLong
setFloat
setDouble

Java 
Arrays

https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html

asList
binarySearch

copyOf
copyOfRange
deepEquals
deepHashCode
deepToString
equals
fill
hashCode
sort
toString

Methods inherited from class java.lang.Object

clone, equals, finalize, hashCode, notify, notifyAll, toString, wait.

blogs to read:
asList
http://stackoverflow.com/questions/20538869/what-is-the-best-way-of-using-arrays-aslist-to-initialize-a-list


copyOfRange:
http://www.tutorialspoint.com/java/util/arrays_copyofrange_short.htm

http://stackoverflow.com/questions/11001720/get-only-part-of-an-array-in-java

more than 2 ways:
   1. copyOfRange
   2. Arrays.asList(array).subList(index, array.Length)

 
http://stackoverflow.com/questions/19389609/array-vs-arraylist-in-performance

http://stackoverflow.com/questions/716597/array-or-list-in-java-which-is-faster

  notes: List   vs ArrayList   List is interface, whereas ArrayList is a concrete class to create object.

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

HackerRank: Sherlock and anagram - warmup practice after 3 months

June 12, 2016

Introduction 

First, software coding -> tennis sports -> gardening - a small talk 

Julia likes blossom of flowers, she enjoyed but does not have time to do any gardening work. She spends a lot of hours on tennis court to keep her physical fit, cheer her up, play social games to build up very good team sports spirit through her workout. 

She observes neighborhood gardeners watering the flower, grass every day in summer time, in the city of Vancouver,  it takes a lot of hard work. She enjoys the neighborhood gardening. 

So, to show some talent in software coding, she likes to learn from a patient gardener, watering, taking away weeds. In other words, read her own coding blog, learn to educate herself better through the short period of time.  

Today, she likes to bring back her favorite practice 3 months ago, an algorithm - "Sherlock and anagram", and then review them, write more practice. 

3 months is not long time, but those past 3 months, Julia found out that she is street-smart again. She starts to get more organized, more time-savvy, and know the importance to push herself to write her own words about experience. It does help. 

One example, she stops to check in C# file using github, she just uses gist to quickly create a link. She did create almost 300 gists, each gist saves 5 minutes compared to check in files using github, she saved 1500 minutes, close to 25 hours time. 

Another example, she tries to focus on reasoning and analysis, writing things to help her solve problem. One problem a time. So, she works on one problem, using more than 5 solutions - BFS, DFS, using Queue, using Stack, phone number problem, therefore, she can apply the problem solving to all other similar problems. 

Workout 

Now, work on the coding:

1. HackerRank: Sherlock and anagram - 7 blogs with practices
Practice on HackerRank is like to play tennis sports, you have to experience various hitting partners, good workout!

No. 1.
http://juliachencoding.blogspot.ca/2016/03/hackerrank-string-sherlock-and-anagrams.html

No. 2
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagrams-ii.html

No. 3

http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlocks-and-anagram-ii.html

No. 4 Study 6 solutions - Julia chose from over 200 solutions
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagrams-iv.html

Julia, work on this code, and put test case in, write your own C# practice:
study the code, order by values,  not by key, try it!
https://gist.github.com/jianminchen/ffcca0582b5f0d1d6a9b

study the blog: Dictionary OrderByDescending
https://goo.gl/6ZbTPz
baby step to learn C# Dictionary class API - Order by and distinct
https://gist.github.com/jianminchen/eff03bea08a95061deb4185af74fea18

No. 6
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagram-vii.html

Warm up 12 solutions - "Sherlock and anagram" one by one. Each one for a blog. Focus on speed, correctness.

Saturday, June 11, 2016

Algorithms to study

June 11, 2016

Prepare to write some code. Find algorithms to work on.

1. Leetcode 76: Minimum Window Substring
Study the code:
http://blog.csdn.net/sunnyyoona/article/details/43925035

2. Leetcode 91: Decode the ways
https://github.com/jianminchen/puzzles/blob/master/decode_ways.cc

2D. Leetcode 128: Longest Consecutive Sequence in Array

2E. Leetcode 139, 140, Word break

2F. Leetcode 150 Evaluate Reverse Polish Notation

3A. Leetcode 289: Game of Life
3B. Leetcode 298: Longest Consecutive Sequence in BT

4. LeetCode 351 - Android Unlock Patterns

Study the code:
http://massivealgorithms.blogspot.ca/2016/06/leetcode-351-android-unlock-patterns.html

5. Read project Euler website:

https://projecteuler.net/archives

6.  Strobogrammatic number I, II, III (246, 247, 248)

Study code:
http://buttercola.blogspot.ca/2015/08/leetcode-strobogrammatic-number.html

https://tonycao.gitbooks.io/leetcode-locked/content/LeetCode%20Locked/c1.5.html

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/246.strobogrammatic-number.java

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/247.strobogrammatic-number-ii.java

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/248.strobogrammatic-number-iii.java

7. One minute call 60 times at most

Leaky bucket algorithm
https://en.wikipedia.org/wiki/Leaky_bucket


8. Stock Maximization
https://www.hackerrank.com/challenges/stockmax

9.

http://www.careercup.com/question?id=5840928073842688

11. Leetcode: shortest word distance I, II, III
https://segmentfault.com/a/1190000003906667

study Leetcode solution:
https://github.com/MaskRay/LeetCode

12. Leetcode 53: Maximum Subarray
https://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray1.cs
https://github.com/jianminchen/Leetcode_C-/blob/master/53MaximumSubArray2.cs

http://juliachencoding.blogspot.ca/2015/07/dp-problem-kadanes-algorithm-maximum.html

13. Leetcode 352 - Data Stream as Disjoint Intervals  (Hard - 34% passing rate)
http://www.cnblogs.com/grandyang/p/5548284.html

14. Leetcode 174 Dungeon game



15. Leetcode 247 H-index



16. Leetcode 269 Alien dictionary

17. Leetcode 142 Linked List Cycle II

17B. Leetcode 286 Walls and Gates

18. Leetcode 329 Longest increasing path in matrix
19. Leetcode 345 Reverse Vowels of a string
20. Leetcode 354 Russian Doll Envelopes

Flatten Linked List
http://www.geeksforgeeks.org/flattening-a-linked-list/

Blogs: Learn system design:
https://www.quora.com/How-should-I-prepare-for-my-Google-interview-if-I-have-1-month-left

80 questions to think about:
https://www.educative.io/collection/5642554087309312/5679846214598656

有O(N*M)的算法,思路是转换成直方图然后维护一个栈。
一个矩阵里,里面元素是0或者1,要你找一个面积最大的全1的子矩阵。
如果不要求是矩形只要求是一块任意形状的区域的话,可以使用FloodFill,O(N*M). 然后这里是矩阵,然后我们转换。
brute force:
枚举左上和右下两个点,然后判断是否全1,这样是 O(N*N*M*M)的算法,因为判断是否全1可以用sum数组来减一下,O(1)就够了。
(detail discussion: https://zhuanlan.zhihu.com/p/19873823?refer=qinchao)
http://poj.org/problem?id=3494
FloodFill
https://en.wikipedia.org/wiki/Flood_fill


blog:
Leetcode 269
C++ solution:
http://www.cnblogs.com/jcliBlogger/p/4758761.html

Discussion about the problem description:
https://leetcode.com/discuss/53997/the-description-is-wrong

C++ solution:

https://leetcode.com/discuss/54024/straightforward-c-solution?show=54024#q54024


Java solution to study:

https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/269.alien-dictionary.java

http://www.cnblogs.com/yrbbest/p/5023584.html

study C# code:
https://gist.github.com/jianminchen/07546625d828f63e762ba03b463fe8aa

Leetcode 329:
http://gaocegege.com/Blog/algorithm/leetcode329

http://blog.csdn.net/sbitswc/article/details/50707203

http://basics.sjtu.edu.cn/~xiaojuan/algo16/

June 20, C# practice:
https://gist.github.com/jianminchen/b984ccba8dabbb0bb78160c6e5c6e8b4

Top 10 Sales techniques for Entrepreneurs

June 11, 2016

 Learn to sell! Spend 1 - 2 hours to do some research on how to sell. Being a software programmer, how to sell the skills/ problem solving skills/ 45 minutes coding in a sprint.



https://www.youtube.com/watch?v=PwwgGOBw1oE

1. Motivation Speaker: Jordan Belfort,

https://en.wikipedia.org/wiki/Jordan_Belfort

2. Advice from Tim Ferriss
   https://en.wikipedia.org/wiki/Tim_Ferriss

   Practicing is only way to get better. Speaking ..., but that is the reason why written word is so powerful. Writing on a crispy paper and then can be reviewed. It is very difficult to do that for the speech. That is the reason I recommend to hold on skills on writing.

  Take time to do study ads, printout etc. Then go back to review, what he falls for, this, or that. What is pushed  you for the edge. And then, sell to people like you.

   Book to read outside business books:
   Recommendation 1:
   Sales -> go to "On Writing Well"
   On Writing Well  by: William Zinsser
   https://books.google.ca/books/about/On_Writing_Well.html?id=USd6AAAAIAAJ&redir_esc=y&hl=en

On Writing Well, which grew out of a course that William Zinsser taught at Yale, has been praised for its sound advice, its clarity, and for the warmth of its style. It is a book for anybody who wants to learn how to write or who needs to do some writing to get through the day, as almost everybody does. Whether you want to write about people or places, science and technology, business, sports, the arts, or about yourself in the increasingly popular memoir genre, On Writing Well offers you both fundamental principles as well as the insights of a distinguished practitioner. How to Write a Memoir tells you how to write the story of your life. Everyone has a story - whether you're a professional writer or just want to validate your personal and family reminiscences, William Zinsser explains how to do it, and do it well.

   Recommendation 2: 
  Bird by Bird   by: Anne Lamott

  Good at writing, improving communication - 
  https://books.google.ca/books/about/Bird_by_Bird.html?id=LISjPwAACAAJ&redir_esc=y

  This volume presents the author's offbeat wisdom about how to write. She recounts her personal experiences to reveal her writing techniques and how she overcomes obstacles that interfere with the writing flow. The author offers concrete suggestions about character, plot, setting, and other topics of interest to writers. She also offers irreverent advice about how to navigate through the dark underbelly feelings of self-doubt, inadequacy, and jealousy that are inevitable parts of any writer's experience. Her humorous advice is based on her own experience and honest self-analysis which provides writers the necessary perspective to keep writing through the difficult times that all writers encounter.

  Recommendation 3: 
  Ogilvy on Advertising   by: David Ogilvy
https://books.google.ca/books?id=FIguPyk2w6YC&q=ogilvy+on+advertising+book&dq=ogilvy+on+advertising+book&hl=en&sa=X&ved=0ahUKEwiXyOqo2aDNAhUMzGMKHSKoChgQ6AEIJDAA   
  An advertising authority updates his analysis of the elements of successful advertising and assesses the advertising environment that has emerged during the past twenty years

3. Gary Vaynerchuk
https://en.wikipedia.org/wiki/Gary_Vaynerchuk

4. Brian Tracy - Life long learning. Quality of thinking -

http://www.briantracy.com/
http://www.briantracy.com/blog/time-management/3-underrated-tips-to-achieve-work-life-balance/

http://www.briantracy.com/blog/category/sales-success/

5. Guy Kawasaki
https://en.wikipedia.org/wiki/Guy_Kawasaki

Follow him on twitter, and find this twitter and an article:
http://www.npr.org/sections/ed/2016/06/01/479335421/practice-makes-possible-what-we-learn-by-studying-amazing-kids

6. Eben Pagan
https://www.facebook.com/Eben-Pagan-135028473246104/

Package info to Ebooks to sell them.

Market them and sell them. Better to learn market and sales themselves.

Best sell method is to have a conversation with them, and try to fit in. Learn a new word today: Consultative sales

7. Mohnish Pabrai

https://en.wikipedia.org/wiki/Mohnish_Pabrai


8. Grant Cardone

https://en.wikipedia.org/wiki/Grant_Cardone

Author of book: Sell To Survive

9. Peter Sage

https://en.wikipedia.org/wiki/Grant_Cardone

10. Zig Ziglar
https://en.wikipedia.org/wiki/Zig_Ziglar

More to study:
Keith Ferrazzi
https://en.wikipedia.org/wiki/Keith_Ferrazzi

http://knowledge.wharton.upenn.edu/article/keith-ferrazzi-relationships-crucial-success/

People relationship:
Invite people in, be generous to the people around me. Universal currency.

Athlete has more than 1 coaches.
Relationship coach -
Professional currency -
3rd layer - some one cares about

Read the script of interview - write down main points:



Learn to lose - my favorite verse to study

June 11, 2016

Learn to lose, I like the teaching from sprinter, most marketable athelete - Usain Bolt.

Like the video, remind me over hundreds of hours on tennis court, play sports in order to get rid of waist bubble, excess body fat, build some muscle and also learn some sports - team spirit, mental toughness, and a lot of fun.

https://www.youtube.com/watch?v=QL5mCN-TTBs

Reading:
1. https://en.wikipedia.org/wiki/Usain_Bolt

2. http://www.runnersworld.co.uk/interview/im-still-here-and-im-still-the-best-rw-talks-to-usain-bolt/13333.html   (10 minute reading, excellent to know how athlete keeps working hard)

copy some sentences Julia likes to read:
I no longer think about what the fans want, or who is running what times and who I need to be on the lookout for. I just think about me, and doing my job. Legacy is the main word in my life now and that means if I’m five meters ahead with 10 to go I won’t be slowing down and beating my chest. I’ll be pushing to get the best time I can, every time.

Julia's comment

Sprinter is much hard compared to software coding in 45 minutes range or system design. Julia, you can do it. Learn to lose.  

Friday, June 10, 2016

C# Hashtable vs Dictionary

June 10, 2016

Spend 2 - 3 hours to look into this topic: C# Hashmap Hashtable vs Dictionary class

Reading always helps to think deeper, and expand the knowledge. Write down notes:




Plan to go over each function in Dictionary class in C#, understand them; get familiar with Dictionary class like SQL statement, slice and dice gets easy to use Dictionary class APIs. 

Code to study:
study the code, use Dictionary class, "Sherlock and anagram" - hackerRank, 
https://gist.github.com/jianminchen/ffcca0582b5f0d1d6a9b

Solution 2:
use Dictionary class, string key for anagram string, use getHashCode() call to turn key as Int.

https://gist.github.com/jianminchen/ffcca0582b5f0d1d6a9b

Read about getHashCode() webpage:
https://msdn.microsoft.com/en-us/library/system.object.gethashcode(v=vs.110).aspx

Solution 3:
https://gist.github.com/jianminchen/8f6bd4631f0b5f0bdee7


Solution 4.
use Dictionary class, sort the key string, then anagram strings will be the same.

https://gist.github.com/jianminchen/59e326cbd1d8910c01c7

30 minutes to practice: 
study the blog: Dictionary OrderByDescending
https://goo.gl/6ZbTPz
baby step to learn C# Dictionary class API - Order by and distinct
https://gist.github.com/jianminchen/eff03bea08a95061deb4185af74fea18



Review a few of terms:

1. generic type - 
2. boxing and unboxing - Hashtable stores Object, need boxing and unboxing

3. thread safe - all memebers vs. only public static memebers
4. speed concern - Dictionary is faster than Hashtable 


Actionable items:

1. Read all dictionary classes: 

  • ConcurrentDictionary - thread safe (can be safely accessed from several threads concurrently)
  • HybridDictionary - optimized performance (for few items and also for many items)
  • OrderedDictionary - values can be accessed via int index (by order in which items were added)
  • SortedDictionary - items automatically sorted
  • StringDictionary - strongly typed and optimized for strings

Motivation talk: 

1. Julia likes to use Dictionary class instead of Hashtable, since Dictionary uses explicit type checking to match its declaration, and it is in compile time. Much better than run time Hashtable box/ unbox - type conversion. 

2. Julia likes to use Dictionary class because it is easy to complete task like order by feature. She likes to find O(N) solution to sort, but in reality, O(nlogn) is fine, just call orderBy API. 


3. Read article extension method:
Extension Methods:
https://msdn.microsoft.com/en-CA/library/bb383977.aspx




Content marketing - ideas to write blogs

June 10, 2016

Spend 1 - 2 hours to do some research on content marketing. It takes some preparation to be able to write a good coding blog, the basic content marketing techniques are helpful.


Mark the ideas Julia likes:

16. Look through your analytics to see your top three blog posts, then write a follow up post for each one. (rank 8 of 10)

28. Create category pages on your website or blog that can make finding your content easier for your visitors. ( 7 out of 10)

32. Try using Quora to find questions people are asking in your niche or industry.

33. Compile Top 10 resource lists for your niche: Top 10 blogs; top 10 companies; top 10 tools, etc. ( 10 out of 10).


Some blogs:

user-focused content strategies that will stand the test of time, while winning approval from users as well as Google.

Julia's comment: 
   Learning takes time; share personal coding experience, and encourage others to work hard as well.





Tuesday, June 7, 2016

A small research on RestAPI, SOA, AWS, AZURE

June 7, 2016

Read the article:
https://www.linkedin.com/pulse/rest-vs-rpc-soa-showdown-joshua-hartman?trk=hp-feed-article-title-hpm

About complaints:
http://www.nytimes.com/2015/07/29/business/linkedin-notorious-for-sending-too-many-emails-cuts-back.html?_r=0

https://azure.microsoft.com/en-us/campaigns/azure-vs-aws/

Amazon AWS:
http://blog.hackerrank.com/how-amazon-web-services-surged-out-of-nowhere/

https://aws.amazon.com/resources/gartner-storage-mq-2014-learn-more/?tag=viglink121898-20

AWS provides durable, low cost cloud storage solutions for their backup, storages and achiving needs. (Pinterest, Dropbox, Adobe, ASANA, etc. )

Actionable items: plan to study 2 hours
Study Amazon Kinesis, most innovative service. Julia, can you name 3 services in AWS? 

https://aws.amazon.com/kinesis/streams/
https://aws.amazon.com/kinesis/streams/details/

Leveling up your JavaScript: - plan to spend at least 30 minutes to read
http://goo.gl/0mDASd

plan to read the article 30 minutes
http://www.cs.cmu.edu/~pavlo/courses/fall2013/static/papers/11730-atc13-bronson.pdf



Top 10 ranking algorithm and practice in June, 2016 (II)

June 7, 2016

Put together her favorite 10 algorithm and practice in the following:


1. HackerRank: Sherlock and anagram - 7 blogs with practices
Practice on HackerRank is like to play tennis sports, you have to experience various hitting partners, good workout!

No. 1.
http://juliachencoding.blogspot.ca/2016/03/hackerrank-string-sherlock-and-anagrams.html

No. 2
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagrams-ii.html

No. 3

http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlocks-and-anagram-ii.html

No. 4 Study 6 solutions - Julia chose from over 200 solutions
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagrams-iv.html

Julia, work on this code, and put test case in, write your own C# practice:
study the code, order by values,  not by key, try it!
https://gist.github.com/jianminchen/ffcca0582b5f0d1d6a9b

study the blog: Dictionary OrderByDescending
https://goo.gl/6ZbTPz
baby step to learn C# Dictionary class API - Order by and distinct
https://gist.github.com/jianminchen/eff03bea08a95061deb4185af74fea18

No. 6
http://juliachencoding.blogspot.ca/2016/03/hackerrank-sherlock-and-anagram-vii.html

Warm up 12 solutions - "Sherlock and anagram" one by one. Each one for a blog. Focus on speed, correctness.


Back to top 10 Ranking - top 2 ...
2. Leetcode 208 course schedule - warm up the algorithm, practice again in short future.
http://juliachencoding.blogspot.ca/2016/04/leetcode-208-course-schedule.html

3. HackerRank: Two strings - C# 15 solutions
http://juliachencoding.blogspot.ca/2016/03/hacker-rank-two-strings.html

4. Leetcode 312 - Burst Balloons -  Julia, please practice it using C# and post here later.

http://juliachencoding.blogspot.ca/2016/02/leetcode-312-burst-balloons.html


5. Binary Tree Post Order Traversal - Iterative solution
http://juliachencoding.blogspot.ca/2016/05/binary-tree-post-order-traversal.html

6. Leetcode 215: find kth largest element - Julia, please practice it using C# and post here later.
http://juliachencoding.blogspot.ca/2016/05/leetcode-215-find-kth-largest-element.html

Study the solution implemented in Java:
https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/215.kth-largest-element-in-an-array.java


7. Connect nodes at same level in binary tree - Julia, please practice it using C# and post here later.
http://juliachencoding.blogspot.ca/2016/05/connect-nodes-at-same-level-in-binary.html


8. Leetcode 15: 3 sum
http://juliachencoding.blogspot.ca/2016/05/leetcode-17-3-sum.html

9. Check number is power of 2
http://juliachencoding.blogspot.ca/2016/05/algorithm-check-if-number-is-power-of-2.html

10. Radix sort and practice:
http://juliachencoding.blogspot.ca/2016/05/radix-sort-distribution-sort.html

11. Leetcode: Maximum Gap
http://juliachencoding.blogspot.ca/2015/06/leetcode-distribution-sort-algorithm.html
http://juliachencoding.blogspot.ca/2015/06/leetcode-maximum-gap-no-164.html

 I know what it takes to win, first arrive, last to leave.

Sunday, June 5, 2016

Study on failing - a small research starts a learning Sunday

June 5, 2016

Julia thought about coding on this Sunday, and then, she decided to do some research first. The topic is called "study on failing".

1. Kevin O'Lery - Failing is Good
https://www.youtube.com/watch?v=1c6OoOHXz0k

1. Fail once, learn and move on
2. 36 months does not make money, then shoot it. It is not a business, it is a hobby.
3. Lose job - Mistakes
2. Kids in school, remove  grades system, allow to fail? Kevin: Fail in early age, learn quickly. Let them prepare early.
    Life is tough out there. Do not make life too easy for kids, let them learn.
3. Learn from Shark Tank TV show,
    ask about Marks for failure:

    Fall apart in talking about numbers.
 
4. Relationship failure - tell the truth.

2. Kevin O'Leary on how to get adhead in the workplace
https://www.youtube.com/watch?v=bG6L5z7fMxE

1. Complete job, and this is a must.
2. Great employee gets the job done; and do not make too much  noise.
3. Make money, not make friends.
4. Work alone vs work in team.
5. Dress for work you want?
    Code ethics - People do not remember what you wear yesterday, that is good.
6. Woman in leadership role?
    Kevin: focus, do not take huge risk; Canada is very open.

3. Kevin O'Leary tips on Negotiating
https://www.youtube.com/watch?v=0TUvuHRRLCA

1. Hesitate to negotiate: tell the truth, take the heat, do not lie.
2. Set goals to live with, have some flexibility
3. How to teach kids to negotiate?
Kevin: teach kids starting from 5 years old. Give them everything they want, you never teach kids anything about negotiate.

Remember a saying: you do not get your deserving, you get what you are negotiating.

4. Process of negotiating:
   3 quotes of changing cars, some one will tell the truth. Spend time to get 3 quotes.

5. Kevin O'Leary's Story
https://www.youtube.com/watch?v=mnCmmHs_XO8

Strict advice: put down guitar, pick up books.
Step father tried to help him out in his teenager.
Play music, take picture, doing nothing. But, step father does not like him do that.

A story, the owner asked him to take off a gum stick on the floor.

7.  ABC 20/20 says Kevin O'Leary is a Bosshole!
https://www.youtube.com/watch?v=Y-SDadRCUug

Respect the boss and trust from the employer.
Sell software billions, at the beginning from her mom's money $10,000 level.
Dad is not sharing his wealth. Only pay his children's education up to their need. Go figure out, go fix it.

8. Kevin O'Leary: Seteve Jobs was the "toughest bastard" ever
https://www.youtube.com/watch?v=eIYDUhLdF3I

Questions:
Respectable vs Fearful
Concept: Work with people never being friends.
Great sales people - a little of bit arts, science
Both are unhappy -> good deal
Fear vs greed
Stock trade -
Transparency of stock trade
Sales are born or made - great sales - Sales manager is different from sales people
Never invest in salesman to run sales -


9. Book:
Kevin O'Leary Book:
Cold hard truth on business money and life.
2 minutes video - the process to write the book, funny and so funny:
https://www.youtube.com/watch?v=u_-ppODHfSk

See if I can take down the words to a note correctly 80% in 20 minutes, again and again. English, vocabulary:
First try:
It is dark and contamin (?) night, the enemy is everywhere.
How to turn a few m
And also I
And also my softside
By my book, ..., a lot of books. Why? Because it is about money, cold hard truth.
mm. Beautiful

Second try:
It is a dk and strm nigt. compt everyhwer, tk out. Too soft.
Compt evh, probly kill them all.
writ bk -> a b dollar empire
Scratch . I am not doing that.
Where was I ? Buy book, a lot, mom, even your dog? Why? Money.
Eat that cold h truth.

Third try:
buddy, kitchen, heat
book worms

typing..
it is dk strmy nigt. compt looks evhe, take them out. Too soft?
Crush them, anngli them, ptu boiling water,
Few tho -> bill, soft side?
scrtach, tearning paper.
Where was I ?
Buy book, for evehwehre, for money, eat that for cold hard truth.

beautful at end with wine.

Fourth try: speed typing.
Buddy-> kitchen -> heat
book worms, with music
typing:
It is dk and stmy nt; Cpt evy, tkae them out -> too soft!
Crusht hem , ana, boiling wta, that is what i like.
Too may , also revealing soft side. a lot of per on flr
buy my bks, a lot of bks, cat even u dog. Why? money
Cold hard truth.

Here is the notes: 
So, it is the dark and stormy night, competitors are everywhere. Take them out. Too soft?
Crush them like croches, annihilate them, put boiling water, ..., kill them all.
Two thousand to a billionaire dollar empire.
Where was I ?
Buy my books, buy a lot of books, for ...

Cold hard truth.

The research just starts from "study on failing", and then, catch up more on outside world.

Video:
Eben Pagan's Top 10 Rules For Success
https://www.youtube.com/watch?v=IOjfqU-ngwM

Michael Gerber's Top 10 Rules For Success
https://www.youtube.com/watch?v=cjy0shpSh60



Thursday, June 2, 2016

Top 10 Ranking Algorithm problems - June 2016

June 2, 2016

 Julia likes to rank her favorite algorithms and also her practice, then she has to chance to dig into more and develop some skills through the practice.

 Here are top 10 practice she likes most:

1. LRU cache - Leetcode 146 - third practice:
http://juliachencoding.blogspot.ca/2016/06/leetcode-146-lru-cache-practice-makes_2.html

http://juliachencoding.blogspot.ca/2016/06/leetcode-146-lru-cache-practice-makes_45.html

 Practice a few more times.

2. Leetcode 126 - Word Ladder II (hard)  - fifth practice
http://juliachencoding.blogspot.ca/2016/05/leetcode-126-word-ladder-ii-using-bfs.html


3. HackerRank: String - Reverse Shuffle Merge (advanced) 5 practices
https://gist.github.com/jianminchen/7572e92ea48211d3d05c557d97601dbf

4. Serialize and Deserialize Tree - 2 study cases
http://juliachencoding.blogspot.ca/2016/05/leetcode-297-serialize-and-deserialize.html

5. Binary Tree Maximum Path sum - second practice
http://juliachencoding.blogspot.ca/2016/05/leetcode-124-binary-tree-maximum-path.html

6. Binary Tree Preorder Traversal - Iterative solution -
http://juliachencoding.blogspot.ca/2016/05/binary-tree-preorder-traversal.html

7. Leetcode 159 - longest substring with at most two distinct characters
http://juliachencoding.blogspot.ca/2016/05/leetcode-159-longest-substring-with-at.html

8. Leetcode 236 - Binary Tree Lowest Common Ancestor - Recursive, Backtracking 
First blog: (5 practices)
http://juliachencoding.blogspot.ca/2016/05/leetcode-236-lowest-common-ancestor.html
Second blog:
http://juliachencoding.blogspot.ca/2016/05/leetcode-236-lowest-common-ancestor_21.html

Third blog:
http://juliachencoding.blogspot.ca/2016/05/leetcode-236-lowest-common-ancestor_22.html

Fourth blog:
http://juliachencoding.blogspot.ca/2016/05/leetcode-236-binary-tree-lowest-common.html

9. Binary Tree Post Order Traversal - Iterative solution
http://juliachencoding.blogspot.ca/2016/05/binary-tree-post-order-traversal.html

10. Leetcode 17: Phone Number Combination
http://juliachencoding.blogspot.ca/2016/04/window-sum.html

There are so many algorithms to list here. But just keep 10 a time.

small talk on code interview

June 2, 2016

Still try to learn something about white board/ code interview.

Study articles, and then write down some notes:
1. https://blog.devmastery.com/how-to-win-the-coding-interview-71ae7102d685#.3ilg3h6vb

Whiteboard and Coding:
Look for a developer who can think on her feet, under pressure, in a room with others.

1. Verbalize your assumptions and seek to confirm them.
Think about assumptions you might be making, and ask me about them.

2. Think out loud.
Show your thought process.
Knowing that you understand how to reason about a problem is far more valuable to me than knowing that you've memorize the name of some built-in function.

Julia's comment:
Draw a diagram to prepare a test case for the problem, at least show some complexity of problem.
Like brute force discussion - how to solve them.

3. Don't be afraid to ask for help
It is very expensive to hire someone who refuses to ask for help when he is stuck?

If you are stuck or don't know something, ask me.

Julia's comment:
Julia has to learn how to communicate, learn a new word: Speak concise with some detail. Stop, and then ask if I answer your question. Do not speak more, showing no confidence. People will ask you more if you stop. Do not volunteer information, do not change topic.

4. Represent your skills and experience honestly

There is a threshold for questions and commentary.

Julia's comment: 
Always be humble. And open to learn.

Part 2 - Coding on a computer

1. Code to spec -

Ask good questions -

2. How well you can follow instructions.

3. Assume that this code will be put into a real production system and write accordingly.

    Your code should be commented.
    You should have error handling or at least logging.
    Your code show avoid breaking at all costs.
    You should have a test harness.
    Your code should be easy-to-read and self-explanatory. (clear variable names, good formatting, ideally "lint free" code).

   suggestions: check JavaScript, jQuery codebase on GitHub.

  "efficient" in production:
  Run fast/  Doesn't take up more memory than it needs to / is stable and easy to maintain.

Part 3: Algorithms
  Khan Academy - https://www.khanacademy.org/computing/computer-science/algorithms

Part 4 - Passing without solving the problem
1. Do not give up too easily.
Put in a real effort.

Julia's comment: Usually there are over 10 solutions working out for a problem. Julia saw hackerRank submissions, so many creative ideas out there.

2. Pseudo-code it.
Julia's comment: call your own function, write a few small functions to support your algorithm. Do not interrupt your main function, write small functions afterwards.

3. List your Know Unknowns

Part 5 - Practice, Practice, Practice

If you practice enough, and really work at it, you'll even be able to handle a question you've never seen before. You'll have confidence and you'll be able to relate it to something else you've probably tried. 


2. https://medium.com/@evnowandforever/f-you-i-quit-hiring-is-broken-bb8f3a48d324#.ydj3j7n2m

How the hashtable is implemented?
https://en.wikipedia.org/wiki/Hash_table

Questions in interview
1. Hash function, key -> index value in associated array
Load factor
Collision
Open addressing

2. Two sum
3. Palindrome





Leetcode 146: LRU Cache - a practice makes difference (III)

June 2, 2016

First two practices:

Warm up the algorithm: (a lot of hurdles, just read source code and then add a lot of comments)

The third practice:

Statistics:
Time spent: 3+ hours