/images/avatar.png

Methods for Deduplicate Array

Using 2 pointers This method does not need to use any containers, and does not need to create the array space. It is recommended, but the position information between the array elements is lost.

Methods For Match Substring

Using regular expression (RECOMMEND) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 private int pattern(String str, String reg) { Pattern pattern = Pattern.compile(reg); // Create a matcher for the input String Matcher matcher = pattern.

Garbage Collection

Theory Garbage Collection is a memory management technique in some programming languages so that developers don’t need to worry about memory deallocation after creating new objects, because garbage collector will destroy those objects automatically.

Binary Search

Insights of Binary Search The size of search spaces ([l, m] or [m, l]) is reduced roughly by a half of the previous iteration, and will eventually reduced to 2 elements and then 1 element at last.

Array

array vs Arrays Arrays is a util function. (usually util function is called object name + s) util function is more like a third party function.