/01-leetcode

upper-middle performance,better than 150%(time+space)

Primary LanguageC++MIT LicenseMIT

upper-middle performance

3. Longest Substring Without Repeating Characters

tips:fast slow pointer
Runtime:faster than 90.01%
Memory Usage:less than 76.39%

4. Median of Two Sorted Arrays

tips:binary search
Runtime:faster than 99.60%
Memory Usage:less than 98.08%

5. Longest Palindromic Substring

tips: manacher
Runtime:faster than 82.83%
Memory Usage:less than 61.40%

10. Regular Expression Matching

tips:dynamic programming
Runtime:faster than 100.00%
Memory Usage:less than 72.15%

23. Merge k Sorted Lists

tips:priority_queue
Runtime:faster than 94.18%
Memory Usage:less than 91.47%

32. Longest Valid Parentheses

tips:dynamic programming
Runtime:faster than 88.50%
Memory Usage:less than 72.42%

37. Sudoku Solver

tips:DFS+Backtracking Runtime:faster than 100.00%
Memory Usage:less than 94.95%

42. Trapping Rain Water

tips:stack Runtime:faster than 100.00%
Memory Usage:less than 85.90%

44. Wildcard Matching

tips:dynamic programming
Runtime:faster than 56.60%
Memory Usage:less than 54.95%

56. Merge Intervals

tips:greedy
Runtime:faster than 98.73%
Memory Usage:less than 99.24%

57. Insert Interval

tips:greedy
Runtime:faster than 99.93%
Memory Usage:less than 95.47%

60. Permutation Sequence

tips:math
Runtime:faster than 100.00%
Memory Usage:less than 93.96%

72. Edit Distance

tips:dynamic programming
Runtime:faster than 56.16%
Memory Usage:less than 52.66%

75. Sort Colors

tips:no tips
Runtime:faster than 100.00%
Memory Usage:less than 15.88%

76. Minimum Window Substring

tips:fast slow pointer
Runtime:faster than 87.98%
Memory Usage:less than 87.56%

79. Word Search

tips:dfs
Runtime:faster than 100.00%
Memory Usage:less than 10.96%

84. Largest Rectangle in Histogram

tips:stack
Runtime:faster than 71.30%
Memory Usage:less than 65.54%

85. Maximal Rectangle

tips:stack
Runtime:faster than 53.71%
Memory Usage:less than 40.75%

91. Decode Ways

tips:dynamic programming
Runtime:faster than 100.00%
Memory Usage:less than 50.71%

92. Reverse Linked List II

tips:list
Runtime:faster than 100.00%
Memory Usage:less than 91.76%

97. Interleaving String

tips:dynamic programming or bfs
Runtime:faster than 100.00%
Memory Usage:less than 48.63%

99. Recover Binary Search Tree

tips:tree
Runtime:faster than 99.69%
Memory Usage:less than 51.40%

115. Distinct Subsequences

tips:dynamic programming or bfs
Runtime:faster than 83.27%
Memory Usage:less than 77.04%

123. Best Time to Buy and Sell Stock III

tips:dynamic programming
Runtime:faster than 16.90%
Memory Usage:less than 90.49%

124. Binary Tree Maximum Path Sum

tips:dynamic programming
Runtime:faster than 64.93%
Memory Usage:less than 92.09%

128. Longest Consecutive Sequence

tips:hash map
Runtime:faster than 40.45%
Memory Usage:less than 7.41%

140. Word Break II

tips:dfs and cache
Runtime:faster than 100.00%
Memory Usage:less than 27.04%

145. Binary Tree Postorder Traversal

tips:tree
Runtime:faster than 100.00%
Memory Usage:less than 82.35%

146. LRU Cache

tips:hash map and list
Runtime:faster than 14.56%
Memory Usage:less than 77.94%

153. Find Minimum in Rotated Sorted Array

tips:divide and conquer
Runtime:faster than 100.00%
Memory Usage:less than 67.04%

154. Find Minimum in Rotated Sorted Array II

tips:divide and conquer
Runtime:faster than 90.14%
Memory Usage:less than 54.05%

164. Maximum Gap

tips:bucket
Runtime:faster than 5.01%
Memory Usage:less than 5.29%

188. Best Time to Buy and Sell Stock IV

tips:dynamic programming
Runtime:faster than 100.00%
Memory Usage:less than 90.20%

200. Number of Islands

tips:dynamic programming
Runtime:faster than 94.53%
Memory Usage:less than 22.12%

200. Number of Islands

tips:dynamic programming
Runtime:faster than 94.53%
Memory Usage:less than 22.12%

204. Count Primes

tips:math
Runtime:faster than 40.11%
Memory Usage:less than 71.58%

410. Split Array Largest Sum

tips:binary search
Runtime:faster than 68.80%
Memory Usage:less than 70.39%

413. Arithmetic Slices

tips:math
Runtime:faster than 100.00%
Memory Usage:less than 84.36%

417. Pacific Atlantic Water Flow

tips:dfs
Runtime:faster than 58.46%
Memory Usage:less than 76.74%

424. Longest Repeating Character Replacement

tips:deque
Runtime:faster than 70.94%
Memory Usage:less than 6.67%

432. All O`one Data Structure

tips:unordered_map+list+list
Runtime:faster than 79.61%
Memory Usage:less than 82.85%

440. K-th Smallest in Lexicographical Order

tips:math+tree
Runtime:faster than 100.00%
Memory Usage:less than 5.56%

446. Arithmetic Slices II - Subsequence

tips:dynamic programming
Runtime:faster than 92.95%
Memory Usage:less than 82.37%

449. Serialize and Deserialize BST

tips:tree
Runtime:faster than 89.25%
Memory Usage:less than 52.07%

458. Poor Pigs

tips:math
Runtime:faster than 100.00%
Memory Usage:less than 89.39%

472. Concatenated Words

tips:dictionary tree Runtime:faster than 31.59%
Memory Usage:less than 43.51%

493. Reverse Pairs

tips:binary indexed tree
Runtime:faster than 73.72%
Memory Usage:less than 65.86%

713. Subarray Product Less Than K

tips:fast slow pointer
Runtime:faster than 96.69%
Memory Usage:less than 76.47%

718. Maximum Length of Repeated Subarray

tips:dynamic programming
Runtime:faster than 76.58%
Memory Usage:less than 96.84%

721. Accounts Merge

tips:unionfind
Runtime:faster than 94.46%
Memory Usage:less than 90.07%

752. Open the Lock

tips:bfs
Runtime:faster than 86.12%
Memory Usage:less than 74.78%

802. Find Eventual Safe States

tips:dfs+graph
Runtime:faster than 89.67%
Memory Usage:less than 96.38%

837. New 21 Game

tips:dynamic programming+math
Runtime:faster than 100.00%
Memory Usage:less than 36.28%

849. Maximize Distance to Closest Person

tips: no tips
Runtime:faster than 99.45%
Memory Usage:less than 88.76%

903. Valid Permutations for DI Sequence

tips:dynamic programming
Runtime:faster than 100.00%
Memory Usage:less than 44.72%