BoscoSuen/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProblemSolution
48. Rotate ImageSolution
54. Spiral Matrix注意半边之后要重新判断
287. Find the Duplicate NumberBinary Search(C++) | Cycle Detection(Java)
418. Sentence Screen Fitting建立退格的mapping
ProblemSolution
33. Search in Rotated Sorted ArraySolution
81. Search in Rotated Sorted Array II多考虑重复的情况
34. Find First and Last Position of Element in Sorted ArraySolution
1044. Longest Duplicate SubstringString Hashing(Rabin Karp's Algorithm) + Binary Search
1268. Search Suggestions Systemlower_bound&upper_bound, use emplace_back
ProblemSolution
162. Find Peak Elementbinary search找peak
315. Count of Smaller Numbers After SelfJava Solution
1008. Construct Binary Search Tree from Preorder Traversal递归O(n)解
ProblemSolution
137. Single Number II解决n个重复数字找不同问题
260. Single Number IIIxor + lowbit
1239. Maximum Length of a Concatenated String with Unique Charactersbit and找intersection优化combination问题 | C++ bitset
ProblemSolution
5. Longest Palindromic SubstringManacher's Algorithm
10. Regular Expression Matching字符串匹配类dp
152. Maximum Product Subarray记录当前结尾的subarray
42. trapping rain waterDP优化为two pointer
72. Edit DistanceSolution
96. Unique Binary Search TreesSolution
188. Best Time to Buy and Sell Stock IV局部最优vs全局最优
300. Longest Increasing Subsequence(LIS)DP + binary search(C++)
368. Largest Divisible SubsetLIS问题变种
354. Russian Doll EnvelopesBinary Search+DP(思路同lc300)
518. Coin Change 2Unbounded Knapsack Problem(C++) | 优化为1维数组(Java)
688. Knight Probability in Chessboarddfs + memo算概率
741. Cherry Pickup转化为两个同时进行的子问题+ dfs + memo
1320. Minimum Distance to Type a Word Using Two Fingersdfs+memorization
221. Maximal Square从对应边长找状态转移方程
1143. Longest Common SubsequenceLCS问题
1312. Minimum Insertion Steps to Make a String Palindrome区间dp(小区间->大区间)
818. Race CarBFS找最短路径 | DP
ProblemSolution
315. Count of Smaller Numbers After SelfC++ Solution
ProblemSolution
863. All Nodes Distance K in Binary Tree由tree建无向图BFS
207. Course ScheduleTopological Sort
210. Course Schedule IITopological Sort
332. Reconstruct ItineraryEularian Path & Hierholzer’s Algorithm
886 Possible BipartitionGraph Coloring
934.Shortest BridgeGraph coloring: dfs + bfs
743. Network Delay TimeDijkstra
787. Cheapest Flights Within K StopsDijkstra
1334. Find the City With the Smallest Number of Neigrs at a Threshold DistanceDijkstra
1192. Critical Connections in a Networktodo
ProblemSolution
55. Jump GameSolution
45. Jump Game IISolution
135. Candy一次遍历 spaceO(1)解
763. Partition Labelsgreedy + two pointer
757. Set Intersection Size At Least TwoSolution
630. Course Schedule III按照结束时间和duration结合greedy
1029. Two City SchedulingGreedy | DP
ProblemSolution
341. Flatten Nested List IteratorList Iterator
ProblemSolution
148. Sort Listmerge sort | space O(1) Solution
ProblemSolution
43. Multiply StringsSolution
50. Pow(x, n)Solution
837. New 21 Game算累加条件概率
ProblemSolution
84. Largest Rectangle in HistogramMonotinic Stack
85. Maximal Rectangle思路同84
402. Remove K DigitsMonotonic Stack
907. Sum of Subarray MinimumsMonotonic stack确定元素范围
239. Sliding Window MaximumMonotic Queue + sliding window
862. Shortest Subarray with Sum at Least KMonotonic Queue + Sliding Window
ProblemSolution
146. LRU CacheHashMap + Doubly Linked List | Java LinkedHashMap
460. LFU CacheHashMap + TreeSet(Ologn) | HashMap + DList(O(1))
642. Design Search Autocomplete SystemTrie + PriorityQueue
895. Maximum Frequency Stack思路同LFU Cache
705. Design HashSetlinkedlist handle hashing collision
706. Design HashMaplinkedlist handle hashing collision
981. Time Based Key-Value StorehashMap + binarySearch
1146. Snapshot Arraylist数组 or TreeMap
ProblemSolution
528. Random Pick with WeightRandom + binarySeach
384. Shuffle an Arrayinside-out shuffle
470. Implement Rand10() Using Rand7()Solution
ProblemSolution
60. Permutation Sequence找到确定每个位置的数字的规律
90.subsets IIsubset去重
127. Word Ladder双向BFS
126. Word Ladder II双向BFS + DFS + path建图(Java) | 单向BFS(C++)
310. Minimum Height Trees建图+BFS
140. Word Break IIDFS + memo
329. Longest Increasing Path in a MatrixDFS + memo
472. Concatenated WordsDFS + memo Solution(C++) | Trie Solution(Java)
489. Robot Room Cleaner模拟dfs, 注意当前robot朝向
ProblemSolution
307. Range Sum Query - MutableSegment Tree模版
ProblemSolution
76. Minimum Window SubstringJava Solution
424. Longest Repeating Character Replacement互补sliding window
480. Sliding Window MedianminHeap + maxHeap
438. Find All Anagrams in a StringSliding window + hashmap模版
560. Subarray Sum Equals K有负数不能用two pointer做sliding window, 换成hashmap的变种
1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitSliding window + monotonic queue
ProblemSolution
468.Validate IP AddressString split, NumberFormatException
ProblemSolution
215. Kth Largest Element in an Arrayquick select
973 K Closest Points to OriginQuick Select
347. Top K Frequent Elementsfreq有上限, bucket sort
ProblemSolution
199. Binary Tree Right Side Viewpreorder + level check
662. Maximum Width of Binary TreeSolution
1110. Delete Nodes And Return ForestSolution
ProblemSolution
846. Hand of Straights注意follow up
ProblemSolution
208. Implement TrieTrie模版
212. Word Search IIDfs + Trie剪枝
421. Maximum XOR of Two Numbers in an ArrayBitwise Trie(按照unsigned int建trie)
472. Concatenated WordsTrie Solution(Java) | DFS + memo Solution(C++)
1268. Search Suggestions SystemTrie
ProblemSolution
695. Max Area of IslandUnion Find | DFS
803. Bricks Falling When HitUnion Find
947. Most Stones Removed with Same Row or ColumnUnion-Find Golang模版
952. Largest Component Size by Common Factor连接公因数的UF

About

My leetcode 2020(Java & C++ & Go)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published