/Leetcode

Primary LanguageJava

Leetcode List

Two Pointer

two Array/String/List

986. Interval List Intersections

左右指针

011. Container With Most Water

240. Search a 2D Matrix II

015. 3Sum

016. 3Sum Closest

018. 4Sum

259. 3Sum Smaller

1099. Two Sum Less Than K

链表双指针

1836. Remove Duplicates From an Unsorted Linked List

82. Remove Duplicates from Sorted List II

438. Find All Anagrams in a String典型模板题

209. Minimum Size Subarray Sum维护窗口的和 同713

713. Subarray Product Less Than K 维护窗口的乘积

Binary Search

034. Find First and Last Position of Element in Sorted Array

find peak element/Rotated Sorted Array

-这类题最重要的是寻找峰值/断崖的位置. 用mid 和mid+1 或者左右边界比较, 判断应该收敛哪个边界.

033. Rotated Sorted Array

153. Find Minimum in Rotated Sorted Array

154. Find Minimum in Rotated Sorted Array II

162. Find Peak Element

Matrix

074. Search a 2D Matrix

find Kth

Search by Value

Sorting/Prefix Sum

Sorting

1329. Sort the Matrix Diagonally 用PQ排序对角线

Prefix Sum

Array

370. Range Addition

363. Max Sum of Rectangle No Larger Than K

Search by Value

图论算法

DFS/BFS

  1. Number of Provinces -DFS -BFS

139. Word Break(BFS)

岛屿问题

130. Surrounded Regions

  1. Number of Islands -DFS -BFS

1905. Count Sub Islands

  1. Pacific Atlantic Water Flow 这题很典型的岛屿问题变式 -BFS

二叉树

117. Populating Next Right Pointers in Each Node II 层序遍历

1448. Count Good Nodes in Binary Tree

1530. Number of Good Leaf Nodes Pairs 这题很有意思 dfs return 一个int array

Backtracking(排列组合问题)

17. Letter Combinations of a Phone Number

22. Generate Parentheses

39.Combination Sum

40.Combination Sum II

47.Permutation II

78.Subsets

79. Word Search

90.Subsets II

797. All Paths From Source to Target

Union Find

547. Number of Provinces(Union Find)

拓扑排序

Heap

215. Kth Largest Element in an Array

253. Meeting Rooms II.

Dynamic Programming

5. Longest Palindromic Substring 从中心扩散判断最长子串

62.Unique Path

91. Decode Ways

139. Word Break

264. Ugly Number II 很有意思的思维方式,按照链表思考dp. 2,3,5 的指针.

300. Longest Increasing Subsequence

413. Arithmetic Slices

673. Number of Longest Increasing Subsequence参考300 题

1143. Longest Common Subsequence

打劫问题

198. House Robber

213. House Robber II

337. House Robber III

Jump Game

55. Jump Game

45. Jump Game II

Greedy Approach

910. Smallest Range II

659. Split Array into Consecutive Subsequences* HashMap+Greedy

871. Minimum Number of Refueling Stops

1338. Reduce Array Size to The Half

503. Next Greater Element II 用二次循环解决首尾相接数组问题

Other

149. Max Points on a Line