Saturday, June 1, 2013

Leetcode Problem difficulty level and frequency table

http://yumei165.blogspot.com/2013/04/leetcode-problem-difficulty-level-and.html

Source: http://leetcode.cloudfoundry.com/
Author: peking2 

Leetcode Questions

IdQuestionDifficultyFreqencyData StructuresAlgorithms
1Two Sum25
  1. array
  2. set
  1. sort
  2. two pointers
2Add Two Numbers34
  1. linked list
  1. two pointers
  2. math
3Longest Substring Without Repeating Characters32
  1. string
  2. hashtable
  1. two pointers
4Median of Two Sorted Arrays53
  1. array
  1. binary search
5Longest Palindromic Substring42
  1. string
6ZigZag Conversion31
  1. string
7Reverse Integer23
  1. math
8String to Integer (atoi)25
  1. string
  1. math
9Palindrome Number22
  1. math
10Regular Expression Matching53
  1. string
  1. recursion
  2. dp
11Container With Most Water32
  1. array
  1. two pointers
12Integer to Roman34
  1. math
13Roman to Integer24
  1. math
14Longest Common Prefix21
  1. string
153Sum35
  1. array
  1. two pointers
163Sum Closest31
  1. array
  1. two pointers
17Letter Combinations of a Phone Number33
  1. string
  1. dfs
184Sum32
  1. array
19Remove Nth Node From End of List23
  1. linked list
  1. two pointers
20Valid Parentheses25
  1. string
  1. stack
21Merge Two Sorted Lists25
  1. linked list
  1. sort
  2. two pointers
  3. merge
22Generate Parentheses34
  1. string
  1. dfs
23Merge k Sorted Lists34
  1. linked list
  2. heap
  1. sort
  2. two pointers
  3. merge
24Swap Nodes in Pairs24
  1. linked list
25Reverse Nodes in k-Group42
  1. linked list
  1. recursion
  2. two pointers
26Remove Duplicates from Sorted Array13
  1. array
  1. two pointers
27Remove Element14
  1. array
  1. two pointers
28Implement strStr()45
  1. string
  1. two pointers
  2. KMP
  3. rolling hash
29Divide Two Integers43
  1. binary search
  2. math
30Substring with Concatenation of All Words31
  1. string
  1. two pointers
31Next Permutation52
  1. array
  1. permutation
32Longest Valid Parentheses41
  1. string
  1. dp
33Search in Rotated Sorted Array43
  1. array
  1. binary search
34Search for a Range43
  1. array
  1. binary search
35Search Insert Position22
  1. array
36Valid Sudoku22
  1. array
37Sudoku Solver42
  1. array
  1. dfs
38Count and Say22
  1. string
  1. two pointers
39Combination Sum33
  1. array
  1. combination
40Combination Sum II42
  1. array
  1. combination
41First Missing Positive52
  1. array
  1. sort
42Trapping Rain Water42
  1. array
  1. two pointers
  2. stack
43Multiply Strings43
  1. string
  1. two pointers
  2. math
44Wildcard Matching53
  1. string
  1. recursion
  2. dp
  3. greedy
45Jump Game II42
  1. array
46Permutations34
  1. array
  1. permutation
47Permutations II42
  1. array
  1. permutation
48Rotate Image42
  1. array
49Anagrams34
  1. string
  2. hashtable
50Pow(x, n)35
  1. binary search
  2. math
51N-Queens43
  1. array
  1. dfs
52N-Queens II43
  1. array
  1. dfs
53Maximum Subarray33
  1. array
  1. dp
54Spiral Matrix42
  1. array
55Jump Game32
  1. array
56Merge Intervals45
  1. array
  2. linked list
  3. red-black tree
  1. sort
  2. merge
57Insert Interval45
  1. array
  2. linked list
  3. red-black tree
  1. sort
  2. merge
58Length of Last Word11
  1. string
59Spiral Matrix II32
  1. array
60Permutation Sequence51
  1. permutation
  2. math
61Rotate List32
  1. linked list
  1. two pointers
62Unique Paths23
  1. array
  1. dp
63Unique Paths II33
  1. array
  1. dp
64Minimum Path Sum33
  1. array
  1. dp
65Valid Number25
  1. string
  1. math
66Plus One12
  1. array
  1. math
67Add Binary24
  1. string
  1. two pointers
  2. math
68Text Justification42
  1. string
69Sqrt(x)44
  1. binary search
70Climbing Stairs25
  1. dp
71Simplify Path31
  1. string
  1. stack
72Edit Distance43
  1. string
  1. dp
73Set Matrix Zeroes35
  1. array
74Search a 2D Matrix33
  1. array
  1. binary search
75Sort Colors42
  1. array
  1. sort
  2. two pointers
76Minimum Window Substring42
  1. string
  1. two pointers
77Combinations34
  1. combination
78Subsets34
  1. array
  1. recursion
  2. combination
79Word Search34
  1. array
  1. dfs
80Remove Duplicates from Sorted Array II22
  1. array
  1. two pointers
81Search in Rotated Sorted Array II53
  1. array
  1. binary search
82Remove Duplicates from Sorted List II33
  1. linked list
  1. recursion
  2. two pointers
83Remove Duplicates from Sorted List13
  1. linked list
84Largest Rectangle in Histogram52
  1. array
  1. stack
85Maximal Rectangle51
  1. array
  1. dp
  2. stack
86Partition List33
  1. linked list
  1. two pointers
87Scramble String52
  1. string
  1. recursion
  2. dp
88Merge Sorted Array25
  1. array
  1. two pointers
  2. merge
89Gray Code42
  1. combination
90Subsets II42
  1. array
  1. recursion
  2. combination
91Decode Ways34
  1. string
  1. recursion
  2. dp
92Reverse Linked List II32
  1. linked list
  1. two pointers
93Restore IP Addresses33
  1. string
  1. dfs
94Binary Tree Inorder Traversal43
  1. tree
  2. hashtable
  1. recursion
  2. morris
  3. stack
95Unique Binary Search Trees II41
  1. tree
  1. dp
  2. dfs
96Unique Binary Search Trees31
  1. tree
  1. dp
97Interleaving String52
  1. string
  1. recursion
  2. dp
98Validate Binary Search Tree35
  1. tree
  1. dfs
99Recover Binary Search Tree42
  1. tree
  1. dfs
100Same Tree11
  1. tree
  1. dfs
101Symmetric Tree12
  1. tree
  1. dfs
102Binary Tree Level Order Traversal34
  1. tree
  1. bfs
103Binary Tree Zigzag Level Order Traversal43
  1. queue
  2. tree
  1. bfs
  2. stack
104Maximum Depth of Binary Tree11
  1. tree
  1. dfs
105Construct Binary Tree from Preorder and Inorder Tr33
  1. array
  2. tree
  1. dfs
106Construct Binary Tree from Inorder and Postorder T33
  1. array
  2. tree
  1. dfs
107Binary Tree Level Order Traversal II31
  1. tree
  1. bfs
108Convert Sorted Array to Binary Search Tree23
  1. tree
  1. dfs
109Convert Sorted List to Binary Search Tree43
  1. linked list
  1. recursion
  2. two pointers
110Balanced Binary Tree12
  1. tree
  1. dfs
111Minimum Depth of Binary Tree11
  1. tree
  1. dfs
112Path Sum13
  1. tree
  1. dfs
113Path Sum II22
  1. tree
  1. dfs
114Flatten Binary Tree to Linked List33
  1. tree
  1. recursion
  2. stack
115Distinct Subsequences42
  1. string
  1. dp
116Populating Next Right Pointers in Each Node33
  1. tree
  1. dfs
117Populating Next Right Pointers in Each Node II42
  1. tree
  1. dfs
118Pascal's Triangle21
  1. array
119Pascal's Triangle II21
  1. array
120Triangle31
  1. array
  1. dp
121Best Time to Buy and Sell Stock21
  1. array
  1. dp
122Best Time to Buy and Sell Stock II31
  1. array
  1. greedy
123Best Time to Buy and Sell Stock III41
  1. array
  1. dp
124Binary Tree Maximum Path Sum42
  1. tree
  1. dfs
125Valid Palindrome25
  1. string
  1. two pointers
126Word Ladder II11
127Word Ladder35
  1. graph
  1. bfs
  2. shortest path
128Longest Consecutive Sequence43
  1. array
129Sum Root to Leaf Numbers24
  1. tree
  1. dfs
130Surrounded Regions43
  1. array
  1. bfs
  2. dfs
131Palindrome Partitioning34
  1. string
  1. dfs
132Palindrome Partitioning II43
  1. string
  1. dp

Emacs basis

2. C-x C-c: exit

3. C-v: next screen M-v: previous screen


C-l: moving the text around the cursor to the center of this screen


4. C-p: previous line C-n: next line


C-f: forward a character C-b: backward a character


M-f: forward a word M-b: backward a word




C-a: moving to the beginning of a line C-e: moving to the end of a line


M-a: moving to the beginning of a sentence M-e: moving to the end of a sentence




Note: Meta characters are used for operations related to the units defined by language (words, sentences, paragraphs), while Control characters operate on basic units that are independent of what you are editing (characters, lines, etc.)




5. M-<: home="" m-="" moving="" of="" text="" the="" to="" whole="">: moving to end of the whole text


6. numeric argument: C-u and then the digits before typing the command. it means repeatedly executing the command.

Excetion: e.g. C-u 8 C-v scrolls screen by 8 lines instead of 8 screens.


7. C-g: discard a command


8. C-x 1: remove other windows


9 delete or kill operations

C-d: delete next character M-d: kill next word

C-k: kill from current position to end of line M-k: kill from current position to end of sentence

: delete char just before cursor M-: kill word just before cursor


general killing method: moving to one end of the text to be killed, typing C-, moving to the other end, typing C-w.


killed text can be brought back, which is called "yanking".


10. yanking---reinsert the last killed text.

C-y


finding most recent killing: C-y

finding some killing: C-y and then M-y untill you find what you want


11 undo

C-x u


12 file operations

C-x C-f : find file C-x C-s: save file


13 buffers

C-x C-b : list buffers

C-x b: switch buffer

C-x s: save some buffer


14 minimize windows C-z


15 replace strings

M-x repl sstring1string2: string1 is replaced by string2


16 major modes: fundamental, lisp, text


17 turn on "auto fill mode"

M-x auto fill mode