haojicc / Leetcode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leetcode

@Bisection Method

  1. 153. Find Minimum in Rotated Sorted Array
  2. 169. Majority Element
  3. 154. Find Minimum in Rotated Sorted Array II

@Divid and Conquer

  1. 912. Sort an Array
  2. 315. Count of Smaller Numbers After Self:

@Recursion

  1. 726. Number of Atoms@string
  2. 856. Score of Parentheses
  3. 290.word pattern
  4. 291.Word Pattern II

Trie

  1. 208. Implement Trie (Prefix Tree) by Golang
  2. 648. Replace Words by Golang
  3. 676. Implement Magic Dictionary by Golang
  4. 677. Map Sum Pairs
  5. [720]
  6. [745]
  7. [211]
  8. [642]
  9. [472]
  10. [425]
  11. [421]
  12. [336]
  13. [212]
  14. [208]

BIT/Segment Tree:

Fenwick Tree was proposed to solve the prefix sum problem.
This method is faster to implement update operations than prefix-sum methods.
The idea is to store Partial Sum in each Node and get total sum by traversing the tree from leaf to root.

  1. 307. Range Sum Query - Mutable
  2. [315]

Monotone + X:

Monotone queue:

  1. [239]

Monotone Stack:

  1. 2355 Maximum Number of Books You Can Take
  2. [901]
  3. [907]
  4. [1019]

Sliding Window:

  1. [239]

Search:

Combination

  1. [17]
  2. [39]
  3. [40]
  4. [77]
  5. [78]
  6. [90]
  7. [216]

Permutation

  1. [46]
  2. [47]
  3. [784]
  4. [943]
  5. [996]

DFS

  1. [22]
  2. [301]
  3. [37]
  4. [51]
  5. [52]
  6. [79]
  7. [212]

BFS

  1. [127]
  2. [126]
  3. [752]
  4. [818]
  5. [542]
  6. [675]
  7. [934]

Partition

  1. [698]
  2. [93]
  3. [131]
  4. [241]
  5. [282]
  6. [842]

Dynamic Programming:

I: O(n), S = O(n), T = O(n^2)

  1. 139. Word Break
  2. 300. Longest Increasing Subsequence
  3. 96. Unique Binary Search Trees
  4. 140. Word Break II
  5. 818. Race Car
  6. #673
  7. #1048

I: O(n), S = O(n), T = O(n):

  1. 70. Climbing Stairs
  2. 746. Min Cost Climbing Stairs
  3. 1137. N-th Tribonacci Number
  4. 1218. Longest Arithmetic Subsequence of Given Difference
  5. 53. Maximum Subarray.cpp
  6. #121

I: O(mn), S = O(mn), T = O(mn)

  1. [62]
  2. [63]
  3. [64]
  4. [120]
  5. [174]
  6. [931]
  7. [1210]
  8. [85]
  9. [211]
  10. [304]
  11. [1277]

I: O(n), S = O(3n), T = O(3n)

  1. [198]
  2. [213]
  3. [309]
  4. [740]
  5. [790]
  6. [801]

I: n, S = O(n), T = O(n*sqrt(n))

  1. [279]

I: O(n), S = O(n), T = O(n^2)

  1. [139]
  2. [140]
  3. [818]
  4. [300]
  5. [673]
  6. [1048]
  7. [96]

I: O(n) + t, S = O(n), T = O(n^2)

  1. [1105]

I: O(n), S = O(2^n), T = O(2^n)

  1. [131]
  2. [89]

I: O(m+n), S = O(mn), T = O(mn)

  1. [72]
  2. [10]
  3. [44]
  4. [97]
  5. [115]
  6. [583]
  7. [712]
  8. [1187]
  9. [1143]
  10. [1092]
  11. [718]

I: O(mn), S = O(mn) T = O(mn*min(n,m))

  1. [1139]

I: O(mn) + k S = O(kmn), T = O(kmn)

  1. [688]
  2. [576]
  3. [935]

I: O(n) + k, S = O(n), T = O(kn)

  1. [322]
  2. [377]
  3. [416]
  4. [494]
  5. [1043]
  6. [1049]
  7. [1220]
  8. [1230]
  9. [1262]
  10. [1269]

I: O(n) + k S = O(n*k), T = O(kn^2)

  1. [813]
  2. [1278]
  3. [1335]
  4. [410]

I: O(n) + k + p S = O(k*p), T = O(n^2kp)

  1. [1223]

I: O(n), S = O(n^2), T = O(n^3)

  1. [312]
  2. [664]
  3. [1024]
  4. [1039]
  5. [1140]
  6. [1130]

I: O(n^2), S = O(n^3), T = O(n^3)

1.[741]

I: O(n), S = O(n^3), T = O(n^4)

  1. [546]

I: O(n) S = O(n2^n), T = (n^22^n)

  1. [943]
  2. [980]
  3. [996]
  4. [1125]

Greedy

  1. [218]
  2. [435]
  3. [452]
  4. [757]
  5. [1024]
  6. [1272]
  7. [1288]
  8. [1326]
  9. [1235]
  10. [1751]
  11. [2008]

List

  1. [2]
  2. [445]
  3. [24]
  4. [206]
  5. [141]
  6. [142]
  7. [23]
  8. [21]
  9. [147]
  10. [148]
  11. [707]

Two Pointers

  1. [11]
  2. [42]
  3. [125]
  4. [455]
  5. [917]
  6. [925]
  7. [986]
  8. [885]
  9. [167]
  10. [15]
  11. [16]
  12. [977]
  13. [992]

Graph

queue + hashtable

  1. [133]
  2. [138]

grid + Connected Components

  1. [200]
  2. [547]
  3. [695]
  4. [733]
  5. [827]
  6. [1162]

DFS + Connected Components

  1. [841]
  2. [1202]

Topology Sorting

  1. [207]
  2. [210]
  3. [802]

Union Find

  1. [399]
  2. [839]
  3. [952]
  4. [990]
  5. [721]
  6. [737]

Bipartition + Graph Coloring

HuaHua's Tech Road: https://zxi.mytechroad.com/

About


Languages

Language:C++ 56.4%Language:C 26.1%Language:CMake 11.5%Language:Go 5.9%