The difference between Linked List and Array List
|
get(index) and add() is O(1) for ArrayList;
Iterator.remove(), ListIterator.add(E element), add() is O(1) for Linked List
|
|
BFS DFS 时间空间复杂度
|
DFS: K - # of children each node has; H - height(depth)
Time O(K^H): extring s1 and String s2, determine if s2 can be used to construct s1
(Find if s2’s char set is a subset of s1’s char set)
|
|
|
Sorted LinkedList, find loop in it
(If (next.val < cur.val) return true;)
|
|
|
Best time to buy and sell stock
|
|
|
Check if one string is rotated string of another
|
|
|
gray code
|
|
|
find nth Fibonacci number
|
|
|
An array of number with length 500 million. All numbers are 10 bit. Sort it
1) Bucket sort
2) Counting sort
3) Radix sort
|
|
|
Delete repeat nodes in a linked list
|
|
|
Min Max Stack
|
|
|
LC: Minimum Window Substring(sub int[] array)
|
|
|
compare version number
|
|
|
valid palindrome
|
|
|
Given any two nodes in a binary tree. Find a path that across least nodes
1) LCA(Least Common Ancestor)
|
|
|
Write a function that will take in email lists and return a new email list that contains only the email addresses that existed in all lists// 1: ,
// 2: ,
// o:
rolling HashSet
or one set
|
|
|
|
|