Skip to content

Latest commit

 

History

History
434 lines (223 loc) · 9.21 KB

index.md

File metadata and controls

434 lines (223 loc) · 9.21 KB
  • Tree
    • Prior: DFS BFS with Iteration/Recursion
    • Traversal
      • In-order
      • Pre-order
      • Post-order
      • Layer
    • Balanced Tree
    • Red-Black Tree
    • B+ Tree
    • Trie
  • Graph
    • Topological Sort
  • hashmap
  • heap
  • stack
    • Monotonic
  • queue
    • circular
    • Monotonic
  • linked list
    • double linked list
  • Union Find
  • LRU
  • Dynamic Programming
    • Digit DP
    • Path DP
    • Memorization
  • Union Find / Disjoint Set
  • Sorting
    • Bubble
    • Selection
    • Insertion
    • Quick
      • Shell
    • Merge
    • Heap
    • Bucket?
    • Radix
    • Counting
  • Backtracking
  • Sliding Window
  • Bit Manipulation
  • Greedy
  • Prefix Sum
  • Combinatorics
  • String
    • KMP
  • SQL
  • ACM 输入输出,链表/树/图的构建

设计模式,单例,工厂 生产者消费者

背包问题 回溯 组合问题, 子集问题, 手动实现哈希表 bat实现randombox,以时间为种子

回溯 Backtracking

77组合 78子集

5 最长回文子串 516 最长回文子序列 手写快排,非递归的快排 堆的实现

手写死锁 线程锁

买卖股票123

生产者消费者模型 条件变量生产者消费者 无锁队列CAS实现生产者消费者

DP 718 72编辑距离

SQL

595_BigCountries 1757_RecyclableAndLowFatProducts

Totally no idea

53_MaximumSubarray

108_ConvertSotedArraytoBinarySearchTree

Tricky

13_RomantoInteger

20_ValidParentheses

70_ClimbingStars

372_SuperPow

1217_MinimumCosttoMoveChipstoTheSamePosition

121_BestTimetoBuyandSellStock

11_ContainerWithMostWater

136_SingleNumber

Multiple methods

287_FindtheDuplicateNumber 1 hashmap 1.1 see array as a hashmap 1.2 set to negative 2 sort() 3 set() 4.1 oneliner 4 find circle in listnode (same idea as 142) 5 modified binary search using pigeonhole principle 6 bit manipulation (the same idea as 1.1 but in a cleaner bitwise format)

Dynamic Programming

53_MaximumSubarray

300_LongestIncreasingSubsequence

70_ClimbingStars

746_MinCostClimbingStairs

42[]

Hashmap

1_TwoSum

138[]

Binary Search

704_BinarySearch

278_FirstBadVersion

35_SearchInsertPosition

69_Sqrtx

74_Searcha2DMatrix

Two Pointer

283_MoveZeros

977_SquaresofaSortedArray

167_TwoSumII_InputArrayisSorted

344_ReverseString

26_RemoveDuplicatesfromSortedArray

19_RemoveNthNodeFromEndofList

905_SortArrayByParity

Backwards two pointer 88_MergeSortedArray

Bit Manipulaiton

136_SingleNumber

Listnode

2_AddTwoNumbers

21_MergeTwoSortedLists

83_RemoveDuplicatesfromSortedList

1290_ConvertBinaryNumberinaLinkedListtoInterger

141_LinkedListCycle

160_IntersectionofTwoLinkedLists

138[]

876_MiddleoftheLinkedList

Stack

20_ValidParentheses

94_BinartTreeInorderTraversal

100_SameTree

101_SymmetricTree

112_PathSum

71_SimplifyPath

Queue

104_MaximumDepthofBinaryTree

111_MinimumDepthofBinaryTree

Recursion

21_MergeTwoSortedLists

70_ClimbingStars

83_RemoveDuplicatesfromSortedList

94_BinartTreeInorderTraversal

100_SameTree

101_SymmetricTree

104_MaximumDepthofBinaryTree

108_ConvertSotedArraytoBinarySearchTree

111_MinimumDepthofBinaryTree

112_PathSum

Tree

94_BinartTreeInorderTraversal

144_BinaryTreePreorderTraversal

145_BinaryTreePostorderTraversal

700_SearchinaBinarySearchTree

100_SameTree

101_SymmetricTree

104_MaximumDepthofBinaryTree

108_ConvertSotedArraytoBinarySearchTree

111_MinimumDepthofBinaryTree

112_PathSum

938_RangeSumofBST

In-place Operation

26_RemoveDuplicatesfromSortedArray

344_ReverseString

Bitwise Operation

231_PowerofTwo

String

71_SimplifyPath

String Match

KMP

https://oi-wiki.org/string/kmp/

28_ImplementstrStr()

Rabin Karp

28_ImplementstrStr()

Bash

193_ValidPhoneNumbers

Neat Oneliners

9_PalindromeNumber

35_SearchInsertPosition

283_MoveZeros

557_ReverseWordsinaStringIII

66_PlusOne

100_SameTree

104_MaximumDepthofBinaryTree

231_PowerofTwo

136_SingleNumber

94_BinartTreeInorderTraversal

144_BinaryTreePreorderTraversal

145_BinaryTreePostorderTraversal

700_SearchinaBinarySearchTree

168_ExcelSheetColumnTitle

171_ExcelSheetColumnNumber

189_RotateArray

My oneliners

977_SquaresofaSortedArray

28_ImplementstrStr()

69_Sqrtx

67_AddBinary

88_MergeSortedArray

171_ExcelSheetColumnNumber

Zeroliner

35_SearchInsertPosition

Tips

Binary Search +1 -1

BFS queue

DFS stack

KMP Rabin Karp String match

two-pointer slow&fast tortoise&hare(rabbit)

permutation == anagram == same letter frequqncy

monotonic queue/stack

alphabet dictionary are super useful

Functions and Features

builtin mudules

sort()

min(a,key=len) get min or max with different keys

collections.deque() appendleft()

Interesting people while browsing leetcode discuss

a stanford teacher https://keithschwarz.com/ https://keithschwarz.com/interesting/code/?dir=find-duplicate