Skip to content

Commit b74b275

Browse files
add 297
1 parent 45ef81b commit b74b275

File tree

13 files changed

+12
-11
lines changed

13 files changed

+12
-11
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Your ideas/fixes/algorithms are more than welcome!
190190
|301|[Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses/)|[Solution](../master/src/main/java/com/stevesun/solutions/RemoveInvalidParentheses.java)| ? | ? | Hard| BFS
191191
|299|[Bulls and Cows](https://leetcode.com/problems/bulls-and-cows/)|[Solution](../master/src/main/java/com/stevesun/solutions/BullsandCows.java)| O(n)|O(1) | Easy|
192192
|298|[Binary Tree Longest Consecutive Sequence](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/)|[Solution](../master/src/main/java/com/stevesun/solutions/BinaryTreeLongestConsecutiveSequence.java)| O(n)|O(n) | Medium | Tree
193-
|297|[Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)|[Solution](../master/src/main/java/com/stevesun/solutions/SerializeandDeserializeBinaryTree.java)| O(n) | O(h) | Hard| BFS
193+
|297|[Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)|[Solution](../master/src/main/java/com/stevesun/solutions/_297.java)| O(n) | O(h) | Hard| BFS
194194
|296|[Best Meeting Point](https://leetcode.com/problems/best-meeting-point/)|[Solution](../master/src/main/java/com/stevesun/solutions/BestMeetingPoint.java)| ?|? | Hard|
195195
|295|[Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/)|[Solution](../master/src/main/java/com/stevesun/solutions/FindMedianFromDataStream.java)| O(nlogn) | O(n) | Hard| Heap
196196
|294|[Flip Game II](https://leetcode.com/problems/flip-game-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/FlipGameII.java)| ? | ?| Medium| Backtracking
@@ -256,6 +256,7 @@ Your ideas/fixes/algorithms are more than welcome!
256256
|222|[Count Complete Tree Nodes](https://leetcode.com/problems/count-complete-tree-nodes/)|[Solution](../master/src/main/java/com/stevesun/solutions/CountCompleteTreeNodes.java)| O(?)|O(h) | Medium|
257257
|220|[Contains Duplicate III](https://leetcode.com/problems/contains-duplicate-iii/)|[Solution](../master/src/main/java/com/stevesun/solutions/ContainsDuplicateIII.java)| O(nlogn)|O(n) | Medium| TreeSet
258258
|219|[Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/ContainsDuplicateII.java)| O(n)|O(n) | Easy| HashMap
259+
|218|[The Skyline Problem](https://leetcode.com/problems/the-skyline-problem/)|[Solution](../master/src/main/java/com/stevesun/solutions/_218.java)| O(n)|O(n) | Hard| TreeMap, Design
259260
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/)|[Solution](../master/src/main/java/com/stevesun/solutions/ContainsDuplicate.java)| O(n)|O(n) | Easy| HashSet
260261
|215|[Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/)|[Solution](../master/src/main/java/com/stevesun/solutions/_215.java)| O(nlogn)|O(n) | Medium| Heap
261262
|212|[Word Search II](https://leetcode.com/problems/word-search-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/WordSearchII.java)| O(m*n*l)|O(l) | Hard | Trie
@@ -274,7 +275,7 @@ Your ideas/fixes/algorithms are more than welcome!
274275
|190|[Reverse Bits](https://leetcode.com/problems/reverse-bits/)|[Solution](../master/src/main/java/com/stevesun/solutions/ReverseBits.java)| O(n)|O(1)| Easy | Bit Manipulation
275276
|189|[Rotate Array](https://leetcode.com/problems/rotate-array/)|[Solution](../master/src/main/java/com/stevesun/solutions/_189.java)| O(n)|O(n), could be optimized to O(1) | Easy
276277
|187|[Repeated DNA Sequences](https://leetcode.com/problems/repeated-dna-sequences/)|[Solution](../master/src/main/java/com/stevesun/solutions/_187.java)| O(n)|O(n) | Medium
277-
|186|[Reverse Words in a String II](https://leetcode.com/problems/reverse-words-in-a-string-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/ReverseWordsinaStringII.java)| O(n)|O(1)| Medium
278+
|186|[Reverse Words in a String II](https://leetcode.com/problems/reverse-words-in-a-string-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/_186.java)| O(n)|O(1)| Medium
278279
|179|[Largest Number](https://leetcode.com/problems/largest-number/)|[Queue](../master/src/main/java/com/stevesun/solutions/BSTIterator_using_q.java) [Stack](../../blmaster/MEDIUM/src/medium/LargestNumber.java)| O(?) |O(?) | Medium|
279280
|174|[Dungeon Game](https://leetcode.com/problems/dungeon-game/)|[Queue](../master/src/main/java/com/stevesun/solutions/BSTIterator_using_q.java) [Stack](../../blmaster/MEDIUM/src/medium/DungeonGame.java)| O(?) |O(?) | Hard|
280281
|173|[Binary Search Tree Iterator](https://leetcode.com/problems/binary-search-tree-iterator/)|[Queue](../master/src/main/java/com/stevesun/solutions/BSTIterator_using_q.java) [Stack](../../blmaster/MEDIUM/src/medium/BSTIterator_using_stack.java)| O(1) |O(h) | Medium|
@@ -295,9 +296,9 @@ Your ideas/fixes/algorithms are more than welcome!
295296
|157|[Read N Characters Given Read4](https://leetcode.com/problems/read-n-characters-given-read4/)|[Solution](../master/src/main/java/com/stevesun/solutions/ReadNCharactersGivenRead4.java)| O(n)|O(1) | Easy|
296297
|156|[Binary Tree Upside Down](https://leetcode.com/problems/binary-tree-upside-down/)|[Solution](../master/src/main/java/com/stevesun/solutions/BinaryTreeUpsideDown.java)| O(n)|O(h) | Medium| Tree, Recursion
297298
|155|[Min Stack](https://leetcode.com/problems/min-stack/)|[Solution](../master/src/main/java/com/stevesun/solutions/MinStack.java)| O(1)|O(n) | Easy| Stack
298-
|153|[Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)|[Solution](../master/src/main/java/com/stevesun/solutions/FindMinimuminRotatedSortedArray.java)| O(logn)|O(1) | Medium| Array, Binary Search
299+
|153|[Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)|[Solution](../master/src/main/java/com/stevesun/solutions/_153.java)| O(logn)|O(1) | Medium| Array, Binary Search
299300
|152|[Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/)|[Solution](../master/src/main/java/com/stevesun/solutions/MaximumProductSubarray.java)| O(n)|O(1) | Medium| Array
300-
|151|[Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string/)|[Solution](../master/src/main/java/com/stevesun/solutions/ReverseWordsinaString.java)| O(n)|O(n) | Medium|
301+
|151|[Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string/)|[Solution](../master/src/main/java/com/stevesun/solutions/_151.java)| O(n)|O(n) | Medium|
301302
|150|[Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/)|[Solution](../master/src/main/java/com/stevesun/solutions/EvaluateReversePolishNotation.java)| O(?)|O(?) | Medium
302303
|149|[Max Points on a Line](https://leetcode.com/problems/max-points-on-a-line/)|[Solution](../master/src/main/java/com/stevesun/solutions/MaxPointsonaLine.java)| O(?)|O(?) | Hard|
303304
|147|[Insertion Sort List](https://leetcode.com/problems/insertion-sort-list/)|[Solution](../master/src/main/java/com/stevesun/solutions/InsertionSortList.java) O(n^2)|O(1) | Medium| Linked List
@@ -324,8 +325,8 @@ Your ideas/fixes/algorithms are more than welcome!
324325
|120|[Triangle](https://leetcode.com/problems/triangle/)|[Solution](../master/src/main/java/com/stevesun/solutions/Triangle.java)| O(m*n)|O(n) | Medium| DP
325326
|119|[Pascal's Triangle II](https://leetcode.com/problems/pascals-triangle-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/PascalsTriangleII.java)| O(n^2)|O(1) | Easy|
326327
|118|[Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/)|[Solution](../master/src/main/java/com/stevesun/solutions/PascalsTriangle.java)| O(n^2)|O(1) | Easy|
327-
|117|[Populating Next Right Pointers in Each Node II](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/PopulatingNextRightPointersinEachNodeII.java)| O(n)|O(1) | Hard| BFS
328-
|116|[Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)|[Solution](../master/src/main/java/com/stevesun/solutions/PopulatingNextRightPointersinEachNode.java)| O(n)|O(1) | Medium| BFS
328+
|117|[Populating Next Right Pointers in Each Node II](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/_117.java)| O(n)|O(1) | Medium| BFS
329+
|116|[Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)|[Solution](../master/src/main/java/com/stevesun/solutions/_116.java)| O(n)|O(1) | Medium| BFS
329330
|115|[Distinct Subsequences](https://leetcode.com/problems/distinct-subsequences/)|[Solution](../master/src/main/java/com/stevesun/solutions/DistinctSubsequences.java)| O(m*n)|O(m*n) | Hard| DP
330331
|114|[Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/)|[Solution](../master/src/main/java/com/stevesun/solutions/FlattenBinaryTreetoLinkedList.java)| O(n)|O(h) | Medium| Tree
331332
|112|[Path Sum](https://leetcode.com/problems/path-sum/)|[Solution](../master/src/main/java/com/stevesun/solutions/PathSum.java)| O(n)|O(1) | Easy| DFS
@@ -337,7 +338,7 @@ Your ideas/fixes/algorithms are more than welcome!
337338
|106|[Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/)|[Solution](../master/src/main/java/com/stevesun/solutions/_106.java)| O(n)|O(n) | Medium| Recursion, Tree
338339
|105|[Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/)|[Solution](../master/src/main/java/com/stevesun/solutions/_105.java)| O(n)|O(n) | Medium| Recursion, Tree
339340
|104|[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/)|[Solution](../master/src/main/java/com/stevesun/solutions/MaximumDepthOfBinaryTree.java)| O(n)|O(h) | Easy| DFS
340-
|103|[Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)|[Solution](../master/src/main/java/com/stevesun/solutions/BinaryTreeZigzagLevelOrderTraversal.java)| O(n)|O(h) | Medium| BFS,DFS
341+
|103|[Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/)|[Solution](../master/src/main/java/com/stevesun/solutions/_103.java)| O(n)|O(h) | Medium| BFS,DFS
341342
|102|[Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/)|[Solution](../master/src/main/java/com/stevesun/solutions/BinaryTreeLevelOrderTraversal.java)| O(n)|O(h) | Easy| BFS
342343
|99|[Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/)|[Solution](../master/src/main/java/com/stevesun/solutions/RecoverBinarySearchTree.java) | O(?) | O(?) | Hard |
343344
|98|[Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/)|[Solution](../master/src/main/java/com/stevesun/solutions/ValidateBinarySearchTree.java) | O(n) | O(h) | Medium | DFS/Recursion
@@ -359,9 +360,9 @@ Your ideas/fixes/algorithms are more than welcome!
359360
|79|[Word Search](https://leetcode.com/problems/word-search/)|[Solution](../master/src/main/java/com/stevesun/solutions/WordSearch.java)|O(m*n*l) ? |O(m*n)|Medium|Backtracking/DFS
360361
|78|[Subsets](https://leetcode.com/problems/subsets/)|[Solution](../master/src/main/java/com/stevesun/solutions/Subsets.java)|O(n^2) ? |O(1)|Medium|Backtracking
361362
|76|[Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/)|[Solution](../master/src/main/java/com/stevesun/solutions/MinimumWindowSubstring.java)|O(n)|O(k)|Hard|Two Pointers
362-
|75|[Sort Colors](https://leetcode.com/problems/sort-colors/)|[Solution](../master/src/main/java/com/stevesun/solutions/SortColors.java)|O(n)|O(1)|Medium| Two Pointers
363+
|75|[Sort Colors](https://leetcode.com/problems/sort-colors/)|[Solution](../master/src/main/java/com/stevesun/solutions/_75.java)|O(n)|O(1)|Medium| Two Pointers
363364
|74|[Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/)|[Solution](../master/src/main/java/com/stevesun/solutions/Searcha2DMatrix.java)|O(logn)|O(1)|Medium| Binary Search
364-
|73|[Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/)|[Solution](../master/src/main/java/com/stevesun/solutions/SetMatrixZeroes.java)|O(mn)|O(mn)|Medium|
365+
|73|[Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/)|[Solution](../master/src/main/java/com/stevesun/solutions/_73.java)|O(mn)|O(mn)|Medium|
365366
|72|[Edit Distance](https://leetcode.com/problems/edit-distance/)|[Solution](../master/src/main/java/com/stevesun/solutions/EditDistance.java)|O(m*n)|O(m+n)|Hard|
366367
|71|[Simplify Path](https://leetcode.com/problems/simplify-path/)|[Solution](../master/src/main/java/com/stevesun/solutions/SimplifyPath.java)|O(n)|O(n)|Medium| Stack
367368
|70|[Climbing Stairs](https://leetcode.com/problems/climbing-stairs/)|[Solution](../master/src/main/java/com/stevesun/solutions/ClimbingStairs.java)|O(n)|O(n)|Easy| DP
@@ -379,7 +380,7 @@ Your ideas/fixes/algorithms are more than welcome!
379380
|56|[Merge Intervals](https://leetcode.com/problems/merge-intervals/)|[Solution](../master/src/main/java/com/stevesun/solutions/MergeIntervals.java)|O(n*logn)|O(1)|Hard|
380381
|55|[Jump Game](https://leetcode.com/problems/jump-game/)|[Solution](../master/src/main/java/com/stevesun/solutions/JumpGame.java)|O(n)|O(1)|Medium|
381382
|54|[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)|[Solution](../master/src/main/java/com/stevesun/solutions/_54.java)|O(m*n)|O(m*n)|Medium| Array
382-
|53|[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)|[Solution](../master/src/main/java/com/stevesun/solutions/MaximumSubarray.java)|O(n)|O(1)|Medium|
383+
|53|[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)|[Solution](../master/src/main/java/com/stevesun/solutions/_53.java)|O(n)|O(1)|Easy|
383384
|50|[Pow(x, n)](https://leetcode.com/problems/powx-n/)|[Solution](../master/src/main/java/com/stevesun/solutions/PowXN.java)|O(logn)|O(logn)|Medium|
384385
|48|[Rotate Image](https://leetcode.com/problems/rotate-image/)|[Solution](../master/src/main/java/com/stevesun/solutions/_48.java)|O(n^2)|O(1)|Medium|Array
385386
|47|[Permutations II](https://leetcode.com/problems/permutations-ii/)|[Solution](../master/src/main/java/com/stevesun/solutions/PermutationsII.java)|O(n*n!)|O(n)|Medium|Backtracking
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
Note: Do not use class member/global/static variables to store states. Your serialize and deserialize algorithms should be stateless.
2424
*/
25-
public class SerializeandDeserializeBinaryTree {
25+
public class _297 {
2626

2727
/**The idea is very straightforward:
2828
use "#" as the terminator, do BFS, level order traversal to store all nodes values into a StringBuilder.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy