Lintcode and Leetcode
-
Linked List
Reverse a linked list: prev = null, curt = head
Find the middle point:
Find the Nth element: remove Nth from END
Dummy node: when structure could be changed (head modify or delete)-
dummy node, int carry = 0; carry = sum / 10; new ListNode(sum % 10)
- 369 Plus One
ListNode dummy = new ListNode(0); dummy.next = head; Stack<ListNode> s = new Stack<>();
- 369 Plus One
-
n log n --> merge sort -> left right -> mid
-
[206 Reversed Linked list I]
-
83 RemoveDuplicatesfromSortedList
- 82 RemoveDuplicatesfromSortedList
int dupVal = curt.val;
- 82 RemoveDuplicatesfromSortedList
-
203 Remove Linked List Elements
if (head.next.val == val)
-
-
[Tree]
-
[BFS]
-
[DFS]