Skip to content

aouos/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Leetcode Problem Solution

ID Name Difficulty Tags
0001 Two Sum (两数之和) array, hash-table
0002 Add Two Numbers (两数相加) ⭐⭐ linked-list, math
0003 lengthOfLongestSubstring (无重复字符的最长子串) ⭐⭐ hash-table, two-pointers, string, sliding-window
0004 findMedianSortedArrays (寻找两个正序数组的中位数) ⭐⭐⭐ array, binary-search, divide-and-conquer
0005 longestPalindrome (最长回文子串) ⭐⭐ string, dynamic-programming
0007 reverse Math
0009 isPalindrome (回文数) math
0011 maxArea (盛最多水的容器) ⭐⭐ array, two-pointers
0012 intToRoman ⭐⭐ Math, String
0013 romanToInt Math, String
0014 Longest Common Prefix (最长公共前缀) string
0015 threeSum (三数之和) ⭐⭐ array, two-pointers
0017 letterCombinations (电话号码的字母组合) ⭐⭐ string, backtracking
0019 removeNthFromEnd (删除链表的倒数第 N 个结点) ⭐⭐ linked-list, two-pointers
0020 isValid (有效的括号) string, stack
0021 mergeTwoLists (合并两个有序链表) linked-list
0022 generateParenthesis (括号生成) ⭐⭐ string, backtracking
0024 Swap Nodes in Pairs (两两交换链表中的节点) ⭐⭐ linked-list, recursion
0026 removeDuplicates Two Pointers, Array
0027 removeElement Two Pointers, Array
0028 strStr Two Pointers, String
0030 findSubstring ⭐⭐⭐ Hash Table, Two Pointers, String
0031 nextPermutation ⭐⭐ Array
0032 longestValidParentheses ⭐⭐⭐ DP, Stack
0033 search ⭐⭐ Array, Binary Search
0034 searchRange (在排序数组中查找元素的第一个和最后一个位置) ⭐⭐ array, binary-search
0035 searchInsert (搜索插入位置) array, binary-search
0039 Combination Sum (组合总和) ⭐⭐ array, backtracking
0042 trap (接雨水) ⭐⭐⭐ array, two-pointers, stack
0046 permute (全排列) ⭐⭐ backtracking
0048 rotate (旋转图像) ⭐⭐ array
0052 totalNQueens ⭐⭐⭐ DFS
0053 maxSubArray (最大子数组和) array, divide-and-conquer, dynamic-programming
0055 Jump Game (跳跃游戏) ⭐⭐ array greedy dynamic-programming
0056 merge (合并区间) ⭐⭐ array, sort
0061 Rotate List (旋转链表) ⭐⭐ linked-list, two-pointers
0062 uniquePaths (不同路径) ⭐⭐ array, dynamic-programming
0064 minPathSum (最小路径和) ⭐⭐ array, dynamic-programming
0066 plusOne Array
0069 mySqrt (x 的平方根 ) binary-search
0070 climbStairs (爬楼梯) dynamic-programming
0074 searchMatrix (搜索二维矩阵) ⭐⭐ array, binary-search
0075 sortColors ⭐⭐ Two Pointers, Array
0076 minWindow ⭐⭐⭐ Sliding Window
0078 Subsets (子集) ⭐⭐ array, backtracking, bit-manipulation
0079 Word Search (单词搜索) ⭐⭐ array, backtracking
0086 partition ⭐⭐ Linked List
0088 merge Array, Two Pointers
0094 inorderTraversal (二叉树的中序遍历) hash-table, stack, tree
0100 Same Tree (相同的树) binary-tree, breadth-first-search, depth-first-search, tree
0101 isSymmetric (对称二叉树) tree, dfs, bfs
0102 levelOrder (二叉树的层序遍历) ⭐⭐ tree, bfs
0104 Maximum Depth of Binary Tree (二叉树的最大深度) binary-tree, breadth-first-search, depth-first-search, tree
0100 isSameTree DFS, Tree
0109 sortedListToBST ⭐⭐ DFS, Recursion
0114 flatten (二叉树展开为链表) ⭐⭐ tree, depth-first-search
0118 generate Array
0121 maxProfit Array, DP
0122 maxProfit Greedy, Array
0128 longestConsecutive (最长连续序列) ⭐⭐ array, union-find
0134 canCompleteCircuit ⭐⭐ Greedy
0136 singleNumber (只出现一次的数字) hash-table, bit-manipulation
0141 hasCycle (环形链表) linked-list, two-pointers
0142 Linked List Cycle II (环形链表 II) ⭐⭐ hash-table, linked-list, two-pointers
0146 LRU Cache (LRU 缓存) ⭐⭐ design, doubly-linked-list, hash-table, linked-list
0148 sortList (排序链表) ⭐⭐ linked-list, sort
0155 minStack (最小栈) stack, design
0160 Intersection of Two Linked Lists (相交链表) hash-table, linked-list, two-pointers
0162 findPeakElement (寻找峰值) ⭐⭐ array, binary-search
0169 majorityElement (多数元素) array, divide-and-conquer, bit-manipulation
0189 rotate ⭐⭐ Array
0191 hammingWeight Bit
0203 removeElements (移除链表元素) linked-list
0204 countPrimes Hash Table
0206 reverseList (反转链表) linked-list
0215 findKthLargest (数组中的第K个最大元素) ⭐⭐ divide-and-conquer, heap
0222 countNodes ⭐⭐ Tree, Binary Search
0232 Implement Queue using Stacks (用栈实现队列) design, stack, queue
0237 deleteNode Linked List
0239 maxSlidingWindow ⭐⭐⭐ Sliding Window
0268 missingNumber Bit, Array
0278 firstBadVersion (第一个错误的版本) binary-search
0290 wordPattern Hash Table
0297 Serialize and Deserialize Binary Tree (二叉树的序列化与反序列化) ⭐⭐⭐ breadth-first-search, depth-first-search, design, string, tree
0283 moveZeroes Array, Two Pointers
0328 oddEvenList ⭐⭐ Linked List
0338 countBits (比特位计数) dynamic-programming, bit-manipulation
0344 reverseString (反转字符串) two-pointers, string
0347 Top K Frequent Elements (前 K 个高频元素) ⭐⭐ hash-table, heap, sort
0372 getSum Bit
0374 guessNumber (猜数字大小) binary-search
0376 wiggleMaxLength ⭐⭐ Greedy, DP
0387 firstUniqChar Hash Table, Array
0389 findTheDifference (找不同) hash-table, bit-manipulation
0394 Decode String (字符串解码) ⭐⭐ stack, string, recursion
0401 readBinaryWatch Bit
0402 removeKdigits ⭐⭐ Stack, Greedy
0406 reconstructQueue ⭐⭐ Greedy
0415 addStrings (字符串相加) string
0424 characterReplacement ⭐⭐ Two Pointers, Sliding Window
0435 eraseOverlapIntervals ⭐⭐ Greedy
0447 numberOfBoomerangs ⭐⭐ Hash Table, Math
0448 findDisappearedNumbers (找到所有数组中消失的数字) array
0451 frequencySort ⭐⭐ Hash Table
0455 findContentChildren Greedy
0461 hammingDistance (汉明距离) bit-manipulation
0494 findTargetSumWays (目标和) dynamic-programming, depth-first-search
0509 fib Array
0513 findBottomLeftValue ⭐⭐ DFS, BFS, Tree
0514 findRotateSteps ⭐⭐⭐ DFS, DP
0518 change ⭐⭐ DP
0543 diameterOfBinaryTree (二叉树的直径) tree
0547 findCircleNum ⭐⭐ DFS, UN
0605 canPlaceFlowers Greedy
0617 mergeTrees (合并二叉树) tree
0628 maximumProduct Array
0647 Palindromic Substrings (回文子串) ⭐⭐ string, dynamic-programming
0674 findLengthOfLCIS Array
0704 binarySearch (二分查找) binary-search
0724 pivotIndex Array
0738 monotoneIncreasingDigits ⭐⭐ Greedy
0739 dailyTemperatures (每日温度) ⭐⭐ hash-table, stack
0746 minCostClimbingStairs DP
0766 isToeplitzMatrix Array
0768 Max Chunks To Make Sorted II (最多能完成排序的块 II) ⭐⭐⭐ array, stack, greedy, sort, monotonic-stack
0781 numRabbits ⭐⭐ Hash Table
0796 rotateString (旋转字符串) string
0814 pruneTree Tree
0821 Shortest Distance to a Character (字符的最短距离) array, two-pointers, string
0830 largeGroupPositions Array
0832 flipAndInvertImage Array
0837 new21Game ⭐⭐ DP, Sliding Window
0860 lemonadeChange Greedy
0876 middleNode Array
0881 numRescueBoats Greedy
0888 fairCandySwap Array
0898 isMonotonic Array
0922 sortArrayByParityII Array, Sort
0942 validMountainArray Math
0987 Vertical Order Traversal of a Binary Tree (二叉树的垂序遍历) ⭐⭐⭐ bfs, binary-tree, dfs, hash-table, tree
0989 Add to Array-Form of Integer (数组形式的整数加法) array, math
1018 prefixesDivBy5 Array
1046 lastStoneWeight Heap, Greedy
1047 removeDuplicates Stack
1052 maxSatisfied ⭐⭐ Sliding Window, Array
1054 rearrangeBarcodes ⭐⭐ Heap, Sort
1122 relativeSortArray Array, Sort
1128 numEquivDominoPairs Array
1206 Skiplist ⭐⭐⭐ Skiplist
1232 checkStraightLine Array
1370 sortString Sort
1381 Design a Stack With Increment Operation (设计一个支持增量操作的栈) ⭐⭐ satck, design, array
1438 longestSubarray ⭐⭐ Sliding Window, Array
1456 maxVowels ⭐⭐ Sliding Window
1710 maximumUnits Sort, Greedy
9001 isUnique Array