Binary Tree TraversalWe should handle at least 2 approaches: recursion and iteration.
Preorder
Binary Tree Preorder Traversalhttps://leetcode.com/problems/binary-tree-preorder-traversal/
Recursion
Save root node value
Call recursion on the left children
Call recursion on the right children
1234...
Quick Sort (Randomized)Quicksort is a Divide and Conquer algorithm. Like all divide-and-conquer algorithms, it first divides a large array into two smaller subarrays and then recursively sort the subarrays. Basically, three steps are involved in the whole process:
Pivot Selection
Randomly (othe...
53. Maximum SubarrayGiven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
A subarray is a contiguous part of an array.
Kanade’s AlgorithmIn an arbitary position i, the maximum subarray sum equals nums[i] or previou...
76. Minimum Window SubstringGiven two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no such substring, return the empty string “”.
Method 1 Sliding Window
2 poi...
啦啦啦啦我爱帆宝