Difficulty: Medium

You are given an integer array `coins`

representing coins of different denominations and an integer `amount`

representing a total amount of money.

Return *the fewest number of coins that you need to make up that amount*. …

Difficulty: Medium

You are given an integer array `coins`

representing coins of different denominations and an integer `amount`

representing a total amount of money.

Return *the fewest number of coins that you need to make up that amount*. …

有关peak的、或者3个什么东西的，尝试遍历 the middle index.

DP题目：先想brute force，想想怎么用recursion做，然后想怎么用iteration来做，然后想怎么用caching的方式来optimize。最后想到底几个数字需要被cache？比如如果是fib,其实只有上两个数字需要被cache。

找那种连续多少个连着xxx的subarray的基本上都可以用sliding window来做。具体方法是：先移动右边一直到找到满足的为止，然后开始移动左边，直到不再满足，就又开始移动右边。这种办法一般来说是最time efficient的。O(n)就可以。或者说可以用某种map/array，把结果放在里面然后遍历那个map本身。这种一般来说给的数字range会比较小，类似100 — 10000之间。

Difficulty: Medium

You are a professional robber planning to rob houses along a street. …

- Why is React efficient?
- how do you declare a variable in React?
- What are something that you cannot use for naming an attribute in React? and Why? What is an alternative name?
- What do you do when you have a JSX element that is single tag? (self closing)
- How do…

First thing to remember is that when we do *inorder traversal *on a *Binary Search Tree (BST) *we can get back a sorted array. Then based on this sorted array of tree nodes we can re-construct a balanced BST and return the node. However, this is a bit tricky because…

The purpose is to find successor of a node on a binary tree (Inorder). One thing special about this problem is that we are given the parent node for each node.

I started by simply traversing through the tree and record all the node and store them in an arrayList…

Again, the logic that head is not null and head.next is not null so that ans = head.next else return head can be shorten to if head is null or head.next is null then we return head. And then we continue with ans = head.next. this is again a logic problem that can be simplified.

We will use LeetCode 76 minimum window substring as an example for the sliding window kinds of problem analysis.

Sliding Window questions go like this:

there will be 2 pointers. First, the left pointer does not move, the right pointer keep going until it finds the first substring(or whatever) that…

a mistakes I made that should be remembered:

when we found a solution I should remember to left++ and right — — otherwise its in an infinite loop.