1. Array is easy to index specific element with index, it’s easier to calculate the difference between different elements than linked list.
2. LeetCode Trap Rain Water problem: iterate left and right elements for each element in the input array, update left and right largest number if larger than the current ones, then get difference between current element and min (leftLargest, rightLargest) as the water in current bucket.
3. Permutation algorithm: one solution is switch each element with current depth element, another one is to remove each element temporarily and go to next depth to generate permutation recursively (recursion can scale down the problem set)
Donate $5 to me for a coffee with PayPal and read more professional and interesting technical blog articles. Feel free to visit my web app, WhizWallet, to apply for credit, store or gift cards, DealsPlus to browse daily deals and store coupons to save money.
Follow me @Yaoli0615 at Twitter to get latest tech updates.