• Stars
    star
    1,142
  • Rank 40,813 (Top 0.9 %)
  • Language
    C++
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My C++ Code for LeetCode OJ

LeetCode

Author: github.com/lzl124631x

My C++ Code for LeetCode OJ.

Please give this repo a if it inspires you. Thanks. 😊

😩 Hate manually copy & pasting the example testcases when solving LeetCode problems?
👉 Try my LeetCode Testcase Extractor

Now I'm using a Chrome Extension I developed -- LeetCoder -- to facilitate my having fun on LeetCode. Features including but not limited to:

  • showing stats
  • copying problem, answer and testcases
  • randomly picking a problem.
# Title Difficulty Solution
1 Two Sum Easy Solution
2 Add Two Numbers Medium Solution
3 Longest Substring Without Repeating Characters Medium Solution
4 Median of Two Sorted Arrays Hard Solution
5 Longest Palindromic Substring Medium Solution
6 ZigZag Conversion Medium Solution
7 Reverse Integer Easy Solution
8 String to Integer (atoi) Medium Solution
9 Palindrome Number Easy Solution
10 Regular Expression Matching Hard Solution
11 Container With Most Water Medium Solution
12 Integer to Roman Medium Solution
13 Roman to Integer Easy Solution
14 Longest Common Prefix Easy Solution
15 3Sum Medium Solution
16 3Sum Closest Medium Solution
17 Letter Combinations of a Phone Number Medium Solution
18 4Sum Medium Solution
19 Remove Nth Node From End of List Medium Solution
20 Valid Parentheses Easy Solution
21 Merge Two Sorted Lists Easy Solution
22 Generate Parentheses Medium Solution
23 Merge k Sorted Lists Hard Solution
24 Swap Nodes in Pairs Medium Solution
25 Reverse Nodes in k-Group Hard Solution
26 Remove Duplicates from Sorted Array Easy Solution
27 Remove Element Easy Solution
28 Implement strStr() Easy Solution
29 Divide Two Integers Medium Solution
30 Substring with Concatenation of All Words Hard Solution
31 Next Permutation Medium Solution
32 Longest Valid Parentheses Hard Solution
33 Search in Rotated Sorted Array Medium Solution
34 Find First and Last Position of Element in Sorted Array Medium Solution
35 Search Insert Position Easy Solution
36 Valid Sudoku Medium Solution
37 Sudoku Solver Hard Solution
38 Count and Say Medium Solution
39 Combination Sum Medium Solution
40 Combination Sum II Medium Solution
41 First Missing Positive Hard Solution
42 Trapping Rain Water Hard Solution
43 Multiply Strings Medium Solution
44 Wildcard Matching Hard Solution
45 Jump Game II Medium Solution
46 Permutations Medium Solution
47 Permutations II Medium Solution
48 Rotate Image Medium Solution
49 Group Anagrams Medium Solution
50 Pow(x, n) Medium Solution
51 N-Queens Hard Solution
52 N-Queens II Hard Solution
53 Maximum Subarray Easy Solution
54 Spiral Matrix Medium Solution
55 Jump Game Medium Solution
56 Merge Intervals Medium Solution
57 Insert Interval Hard Solution
58 Length of Last Word Easy Solution
59 Spiral Matrix II Medium Solution
60 Permutation Sequence Hard Solution
61 Rotate List Medium Solution
62 Unique Paths Medium Solution
63 Unique Paths II Medium Solution
64 Minimum Path Sum Medium Solution
65 Valid Number Hard Solution
66 Plus One Easy Solution
67 Add Binary Easy Solution
68 Text Justification Hard Solution
69 Sqrt(x) Easy Solution
70 Climbing Stairs Easy Solution
71 Simplify Path Medium Solution
72 Edit Distance Hard Solution
73 Set Matrix Zeroes Medium Solution
74 Search a 2D Matrix Medium Solution
75 Sort Colors Medium Solution
76 Minimum Window Substring Hard Solution
77 Combinations Medium Solution
78 Subsets Medium Solution
79 Word Search Medium Solution
80 Remove Duplicates from Sorted Array II Medium Solution
81 Search in Rotated Sorted Array II Medium Solution
82 Remove Duplicates from Sorted List II Medium Solution
83 Remove Duplicates from Sorted List Solution
84 Largest Rectangle in Histogram Hard Solution
85 Maximal Rectangle Hard Solution
86 Partition List Medium Solution
87 Scramble String Hard Solution
88 Merge Sorted Array Easy Solution
89 Gray Code Medium Solution
90 Subsets II Medium Solution
91 Decode Ways Medium Solution
92 Reverse Linked List II Medium Solution
93 Restore IP Addresses Solution
94 Binary Tree Inorder Traversal Easy Solution
95 Unique Binary Search Trees II Medium Solution
96 Unique Binary Search Trees Medium Solution
97 Interleaving String Hard Solution
98 Validate Binary Search Tree Medium Solution
99 Recover Binary Search Tree Hard Solution
100 Same Tree Easy Solution
101 Symmetric Tree Solution
102 Binary Tree Level Order Traversal Medium Solution
103 Binary Tree Zigzag Level Order Traversal Medium Solution
104 Maximum Depth of Binary Tree Easy Solution
106 Construct Binary Tree from Inorder and Postorder Traversal Medium Solution
107 Binary Tree Level Order Traversal II Medium Solution
108 Convert Sorted Array to Binary Search Tree Easy Solution
109 Convert Sorted List to Binary Search Tree Medium Solution
110 Balanced Binary Tree Easy Solution
111 Minimum Depth of Binary Tree Easy Solution
112 Path Sum Easy Solution
113 Path Sum II Medium Solution
114 Flatten Binary Tree to Linked List Medium Solution
115 Distinct Subsequences Hard Solution
116 Populating Next Right Pointers in Each Node Medium Solution
117 Populating Next Right Pointers in Each Node II Medium Solution
118 Pascal's Triangle Easy Solution
119 Pascal's Triangle II Easy Solution
120 Triangle Medium Solution
121 Best Time to Buy and Sell Stock Easy Solution
122 Best Time to Buy and Sell Stock II Easy Solution
123 Best Time to Buy and Sell Stock III Hard Solution
124 Binary Tree Maximum Path Sum Hard Solution
125 Valid Palindrome Easy Solution
126 Word Ladder II Hard Solution
127 Word Ladder Hard Solution
128 Longest Consecutive Sequence Hard Solution
129 Sum Root to Leaf Numbers Medium Solution
130 Surrounded Regions Medium Solution
131 Palindrome Partitioning Medium Solution
133 Clone Graph Medium Solution
134 Gas Station Medium Solution
135 Candy Hard Solution
136 Single Number Easy Solution
137 Single Number II Medium Solution
138 Copy List with Random Pointer Medium Solution
139 Word Break Medium Solution
140 Word Break II Hard Solution
141 Linked List Cycle Easy Solution
142 Linked List Cycle II Medium Solution
143 Reorder List Medium Solution
144 Binary Tree Preorder Traversal Easy Solution
145 Binary Tree Postorder Traversal Easy Solution
146 LRU Cache Medium Solution
147 Insertion Sort List Medium Solution
148 Sort List Medium Solution
149 Max Points on a Line Hard Solution
150 Evaluate Reverse Polish Notation Medium Solution
151 Reverse Words in a String Medium Solution
152 Maximum Product Subarray Medium Solution
153 Find Minimum in Rotated Sorted Array Medium Solution
154 Find Minimum in Rotated Sorted Array II Hard Solution
155 Min Stack Easy Solution
156 Binary Tree Upside Down Medium Solution
157 Read N Characters Given Read4 Easy Solution
158 Read N Characters Given Read4 II - Call multiple times Hard Solution
159 Longest Substring with At Most Two Distinct Characters Medium Solution
160 Intersection of Two Linked Lists Easy Solution
161 One Edit Distance Medium Solution
162 Find Peak Element Medium Solution
163 Missing Ranges Easy Solution
164 Maximum Gap Hard Solution
165 Compare Version Numbers Medium Solution
166 Fraction to Recurring Decimal Solution
167 Two Sum II - Input array is sorted Solution
169 Majority Element Easy Solution
170 Two Sum III - Data structure design Easy Solution
171 Excel Sheet Column Number Easy Solution
173 Binary Search Tree Iterator Medium Solution
174 Dungeon Game Hard Solution
175 Combine Two Tables Easy Solution
176 Second Highest Salary Easy Solution
179 Largest Number Medium Solution
181 Employees Earning More Than Their Managers Easy Solution
182 Duplicate Emails Easy Solution
186 Reverse Words in a String II Medium Solution
187 Repeated DNA Sequences Solution
188 Best Time to Buy and Sell Stock IV Hard Solution
189 Rotate Array Medium Solution
190 Reverse Bits Easy Solution
191 Number of 1 Bits Easy Solution
195 Tenth Line Easy Solution
198 House Robber Medium Solution
199 Binary Tree Right Side View Medium Solution
200 Number of Islands Medium Solution
201 Bitwise AND of Numbers Range Medium Solution
202 Happy Number Easy Solution
203 Remove Linked List Elements Easy Solution
204 Count Primes Easy Solution
205 Isomorphic Strings Easy Solution
206 Reverse Linked List Easy Solution
207 Course Schedule Medium Solution
208 Implement Trie (Prefix Tree) Medium Solution
209 Minimum Size Subarray Sum Medium Solution
210 Course Schedule II Medium Solution
211 Add and Search Word - Data structure design Medium Solution
212 Word Search II Hard Solution
213 House Robber II Medium Solution
214 Shortest Palindrome Hard Solution
215 Kth Largest Element in an Array Medium Solution
216 Combination Sum III Medium Solution
217 Contains Duplicate Easy Solution
218 The Skyline Problem Hard Solution
219 Contains Duplicate II Easy Solution
220 Contains Duplicate III Medium Solution
221 Maximal Square Medium Solution
222 Count Complete Tree Nodes Medium Solution
223 Rectangle Area Solution
224 Basic Calculator Hard Solution
225 Implement Stack using Queues Easy Solution
226 Invert Binary Tree Easy Solution
227 Basic Calculator II Medium Solution
228 Summary Ranges Easy Solution
229 Majority Element II Solution
230 Kth Smallest Element in a BST Medium Solution
231 Power of Two Easy Solution
232 Implement Queue using Stacks Easy Solution
234 Palindrome Linked List Easy Solution
235 Lowest Common Ancestor of a Binary Search Tree Easy Solution
236 Lowest Common Ancestor of a Binary Tree Medium Solution
237 Delete Node in a Linked List Easy Solution
238 Product of Array Except Self Medium Solution
239 Sliding Window Maximum Hard Solution
240 Search a 2D Matrix II Medium Solution
241 Different Ways to Add Parentheses Medium Solution
242 Valid Anagram Easy Solution
243 Shortest Word Distance Easy Solution
244 Shortest Word Distance II Medium Solution
246 Strobogrammatic Number Easy Solution
247 Strobogrammatic Number II Medium Solution
249 Group Shifted Strings Medium Solution
250 Count Univalue Subtrees Medium Solution
251 Flatten 2D Vector Medium Solution
252 Meeting Rooms Easy Solution
253 Meeting Rooms II Medium Solution
255 Verify Preorder Sequence in Binary Search Tree Medium Solution
256 Paint House Easy Solution
257 Binary Tree Paths Easy Solution
258 Add Digits Easy Solution
259 3Sum Smaller Medium Solution
260 Single Number III Medium Solution
261 Graph Valid Tree Medium Solution
263 Ugly Number Solution
264 Ugly Number II Medium Solution
266 Palindrome Permutation Easy Solution
268 Missing Number Easy Solution
269 Alien Dictionary Hard Solution
270 Closest Binary Search Tree Value Easy Solution
271 Encode and Decode Strings Medium Solution
273 Integer to English Words Hard Solution
274 H-Index Medium Solution
275 H-Index II Medium Solution
276 Paint Fence Medium Solution
277 Find the Celebrity Medium Solution
278 First Bad Version Easy Solution
279 Perfect Squares Medium Solution
280 Wiggle Sort Medium Solution
281 Zigzag Iterator Medium Solution
284 Peeking Iterator Medium Solution
285 Inorder Successor in BST Medium Solution
286 Walls and Gates Medium Solution
287 Find the Duplicate Number Medium Solution
289 Game of Life Medium Solution
290 Word Pattern Easy Solution
291 Word Pattern II Medium Solution
293 Flip Game Easy Solution
294 Flip Game II Medium Solution
295 Find Median from Data Stream Hard Solution
296 Best Meeting Point Hard Solution
297 Serialize and Deserialize Binary Tree Hard Solution
298 Binary Tree Longest Consecutive Sequence Medium Solution
299 Bulls and Cows Medium Solution
300 Longest Increasing Subsequence Medium Solution
301 Remove Invalid Parentheses Hard Solution
302 Smallest Rectangle Enclosing Black Pixels Hard Solution
303 Range Sum Query - Immutable Solution
304 Range Sum Query 2D - Immutable Solution
307 Range Sum Query - Mutable Medium Solution
309 Best Time to Buy and Sell Stock with Cooldown Medium Solution
310 Minimum Height Trees Medium Solution
311 Sparse Matrix Multiplication Medium Solution
312 Burst Balloons Hard Solution
313 Super Ugly Number Solution
314 Binary Tree Vertical Order Traversal Medium Solution
315 Count of Smaller Numbers After Self Hard Solution
316 Remove Duplicate Letters Medium Solution
317 Shortest Distance from All Buildings Hard Solution
318 Maximum Product of Word Lengths Medium Solution
320 Generalized Abbreviation Medium Solution
321 Create Maximum Number Hard Solution
322 Coin Change Medium Solution
323 Number of Connected Components in an Undirected Graph Medium Solution
324 Wiggle Sort II Solution
325 Maximum Size Subarray Sum Equals k Medium Solution
326 Power of Three Easy Solution
327 Count of Range Sum Hard Solution
328 Odd Even Linked List Easy Solution
329 Longest Increasing Path in a Matrix Hard Solution
330 Patching Array Solution
331 Verify Preorder Serialization of a Binary Tree Solution
332 Reconstruct Itinerary Hard Solution
333 Largest BST Subtree Medium Solution
334 Increasing Triplet Subsequence Medium Solution
335 Self Crossing Solution
336 Palindrome Pairs Hard Solution
337 House Robber III Medium Solution
338 Counting Bits Easy Solution
339 Nested List Weight Sum Easy Solution
340 Longest Substring with At Most K Distinct Characters Hard Solution
341 Flatten Nested List Iterator Medium Solution
342 Power of Four Easy Solution
343 Integer Break Medium Solution
344 Reverse String Easy Solution
345 Reverse Vowels of a String Easy Solution
346 Moving Average from Data Stream Easy Solution
347 Top K Frequent Elements Medium Solution
348 Design Tic-Tac-Toe Medium Solution
349 Intersection of Two Arrays Easy Solution
350 Intersection of Two Arrays II Solution
352 Data Stream as Disjoint Intervals Solution
354 Russian Doll Envelopes Hard Solution
355 Design Twitter Medium Solution
357 Count Numbers with Unique Digits Solution
359 Logger Rate Limiter Easy Solution
360 Sort Transformed Array Medium Solution
361 Bomb Enemy Medium Solution
362 Design Hit Counter Medium Solution
363 Max Sum of Rectangle No Larger Than K Hard Solution
364 Nested List Weight Sum II Medium Solution
365 Water and Jug Problem Solution
366 Find Leaves of Binary Tree Medium Solution
367 Valid Perfect Square Easy Solution
368 Largest Divisible Subset Medium Solution
369 Plus One Linked List Medium Solution
370 Range Addition Medium Solution
371 Sum of Two Integers Medium Solution
372 Super Pow Solution
373 Find K Pairs with Smallest Sums Solution
374 Guess Number Higher or Lower Easy Solution
375 Guess Number Higher or Lower II Medium Solution
376 Wiggle Subsequence Medium Solution
377 Combination Sum IV Medium Solution
378 Kth Smallest Element in a Sorted Matrix Medium Solution
379 Design Phone Directory Medium Solution
380 Insert Delete GetRandom O(1) Medium Solution
381 Insert Delete GetRandom O(1) - Duplicates allowed Hard Solution
382 Linked List Random Node Medium Solution
383 Ransom Note Easy Solution
384 Shuffle an Array Medium Solution
385 Mini Parser Medium Solution
386 Lexicographical Numbers Medium Solution
387 First Unique Character in a String Easy Solution
388 Longest Absolute File Path Medium Solution
389 Find the Difference Easy Solution
390 Elimination Game Solution
391 Perfect Rectangle Solution
392 Is Subsequence Easy Solution
393 UTF-8 Validation Solution
394 Decode String Medium Solution
395 Longest Substring with At Least K Repeating Characters Medium Solution
396 Rotate Function Medium Solution
397 Integer Replacement Solution
398 Random Pick Index Solution
399 Evaluate Division Medium Solution
400 Nth Digit Medium Solution
401 Binary Watch Solution
402 Remove K Digits Medium Solution
403 Frog Jump Hard Solution
404 Sum of Left Leaves Easy Solution
405 Convert a Number to Hexadecimal Solution
406 Queue Reconstruction by Height Medium Solution
407 Trapping Rain Water II Hard Solution
408 Valid Word Abbreviation Easy Solution
409 Longest Palindrome Easy Solution
410 Split Array Largest Sum Hard Solution
412 Fizz Buzz Easy Solution
413 Arithmetic Slices Medium Solution
414 Third Maximum Number Solution
415 Add Strings Easy Solution
416 Partition Equal Subset Sum Medium Solution
417 Pacific Atlantic Water Flow Medium Solution
418 Sentence Screen Fitting Medium Solution
419 Battleships in a Board Solution
420 Strong Password Checker Solution
421 Maximum XOR of Two Numbers in an Array Medium Solution
422 Valid Word Square Easy Solution
423 Reconstruct Original Digits from English Solution
424 Longest Repeating Character Replacement Medium Solution
425 Word Squares Hard Solution
426 Convert Binary Search Tree to Sorted Doubly Linked List Medium Solution
427 Construct Quad Tree Medium Solution
429 N-ary Tree Level Order Traversal Medium Solution
430 Flatten a Multilevel Doubly Linked List Medium Solution
431 Encode N-ary Tree to Binary Tree Hard Solution
432 All O`one Data Structure Solution
433 Minimum Genetic Mutation Medium Solution
434 Number of Segments in a String Solution
435 Non-overlapping Intervals Medium Solution
436 Find Right Interval Medium Solution
437 Path Sum III Medium Solution
438 Find All Anagrams in a String Medium Solution
439 Ternary Expression Parser Medium Solution
440 K-th Smallest in Lexicographical Order Solution
441 Arranging Coins Easy Solution
442 Find All Duplicates in an Array Medium Solution
443 String Compression Medium Solution
445 Add Two Numbers II Medium Solution
446 Arithmetic Slices II - Subsequence Hard Solution
447 Number of Boomerangs Solution
448 Find All Numbers Disappeared in an Array Easy Solution
449 Serialize and Deserialize BST Solution
450 Delete Node in a BST Medium Solution
451 Sort Characters By Frequency Medium Solution
452 Minimum Number of Arrows to Burst Balloons Medium Solution
453 Minimum Moves to Equal Array Elements Solution
454 4Sum II Medium Solution
455 Assign Cookies Solution
456 132 Pattern Medium Solution
457 Circular Array Loop Medium Solution
459 Repeated Substring Pattern Easy Solution
460 LFU Cache Solution
461 Hamming Distance Easy Solution
462 Minimum Moves to Equal Array Elements II Medium Solution
463 Island Perimeter Easy Solution
464 Can I Win Solution
466 Count The Repetitions Hard Solution
467 Unique Substrings in Wraparound String Solution
468 Validate IP Address Medium Solution
470 Implement Rand10() Using Rand7() Medium Solution
471 Encode String with Shortest Length Hard Solution
472 Concatenated Words Hard Solution
473 Matchsticks to Square Medium Solution
474 Ones and Zeroes Medium Solution
475 Heaters Solution
476 Number Complement Easy Solution
477 Total Hamming Distance Solution
478 Generate Random Point in a Circle Medium Solution
479 Largest Palindrome Product Hard Solution
480 Sliding Window Median Solution
481 Magical String Solution
482 License Key Formatting Solution
483 Smallest Good Base Hard Solution
485 Max Consecutive Ones Easy Solution
486 Predict the Winner Medium Solution
487 Max Consecutive Ones II Medium Solution
488 Zuma Game Solution
489 Robot Room Cleaner Hard Solution
490 The Maze Medium Solution
491 Increasing Subsequences Medium Solution
492 Construct the Rectangle Solution
493 Reverse Pairs Hard Solution
494 Target Sum Medium Solution
495 Teemo Attacking Medium Solution
496 Next Greater Element I Easy Solution
497 Random Point in Non-overlapping Rectangles Medium Solution
498 Diagonal Traverse Solution
499 The Maze III Hard Solution
500 Keyboard Row Easy Solution
501 Find Mode in Binary Search Tree Easy Solution
502 IPO Hard Solution
503 Next Greater Element II Medium Solution
504 Base 7 Easy Solution
505 The Maze II Medium Solution
506 Relative Ranks Easy Solution
507 Perfect Number Easy Solution
508 Most Frequent Subtree Sum Medium Solution
509 Fibonacci Number Easy Solution
510 Inorder Successor in BST II Medium Solution
513 Find Bottom Left Tree Value Medium Solution
514 Freedom Trail Hard Solution
515 Find Largest Value in Each Tree Row Medium Solution
516 Longest Palindromic Subsequence Medium Solution
517 Super Washing Machines Hard Solution
518 Coin Change 2 Medium Solution
519 Random Flip Matrix Medium Solution
520 Detect Capital Easy Solution
521 Longest Uncommon Subsequence I Easy Solution
522 Longest Uncommon Subsequence II Medium Solution
523 Continuous Subarray Sum Medium Solution
524 Longest Word in Dictionary through Deleting Medium Solution
525 Contiguous Array Medium Solution
526 Beautiful Arrangement Medium Solution
528 Random Pick with Weight Medium Solution
529 Minesweeper Medium Solution
530 Minimum Absolute Difference in BST Easy Solution
532 K-diff Pairs in an Array Medium Solution
535 Encode and Decode TinyURL Medium Solution
536 Construct Binary Tree from String Solution
537 Complex Number Multiplication Medium Solution
538 Convert BST to Greater Tree Medium Solution
539 Minimum Time Difference Solution
540 Single Element in a Sorted Array Medium Solution
541 Reverse String II Solution
542 01 Matrix Medium Solution
543 Diameter of Binary Tree Easy Solution
544 Output Contest Matches Medium Solution
545 Boundary of Binary Tree Medium Solution
546 Remove Boxes Hard Solution
547 Friend Circles Medium Solution
549 Binary Tree Longest Consecutive Sequence II Medium Solution
551 Student Attendance Record I Easy Solution
552 Student Attendance Record II Hard Solution
553 Optimal Division Medium Solution
554 Brick Wall Medium Solution
556 Next Greater Element III Medium Solution
557 Reverse Words in a String III Solution
558 Quad Tree Intersection Easy Solution
559 Maximum Depth of N-ary Tree Easy Solution
560 Subarray Sum Equals K Medium Solution
561 Array Partition I Solution
562 Longest Line of Consecutive One in Matrix Solution
563 Binary Tree Tilt Easy Solution
564 Find the Closest Palindrome Hard Solution
565 Array Nesting Medium Solution
566 Reshape the Matrix Easy Solution
567 Permutation in String Medium Solution
568 Maximum Vacation Days Hard Solution
570 Managers with at Least 5 Direct Reports Medium Solution
572 Subtree of Another Tree Easy Solution
573 Squirrel Simulation Medium Solution
575 Distribute Candies Easy Solution
576 Out of Boundary Paths Medium Solution
577 Employee Bonus Easy Solution
581 Shortest Unsorted Continuous Subarray Medium Solution
582 Kill Process Medium Solution
583 Delete Operation for Two Strings Medium Solution
584 Find Customer Referee Easy Solution
586 Customer Placing the Largest Number of Orders Easy Solution
588 Design In-Memory File System Hard Solution
589 N-ary Tree Preorder Traversal Easy Solution
590 N-ary Tree Postorder Traversal Easy Solution
591 Tag Validator Hard Solution
592 Fraction Addition and Subtraction Medium Solution
593 Valid Square Medium Solution
594 Longest Harmonious Subsequence Easy Solution
595 Big Countries Easy Solution
597 Friend Requests I: Overall Acceptance Rate Easy Solution
598 Range Addition II Easy Solution
599 Minimum Index Sum of Two Lists Easy Solution
600 Non-negative Integers without Consecutive Ones Hard Solution
603 Consecutive Available Seats Easy Solution
604 Design Compressed String Iterator Easy Solution
605 Can Place Flowers Easy Solution
606 Construct String from Binary Tree Easy Solution
607 Sales Person Easy Solution
609 Find Duplicate File in System Medium Solution
610 Triangle Judgement Easy Solution
611 Valid Triangle Number Medium Solution
613 Shortest Distance in a Line Easy Solution
616 Add Bold Tag in String Medium Solution
617 Merge Two Binary Trees Easy Solution
620 Not Boring Movies Easy Solution
621 Task Scheduler Medium Solution
622 Design Circular Queue Medium Solution
623 Add One Row to Tree Medium Solution
624 Maximum Distance in Arrays Medium Solution
627 Swap Salary Easy Solution
628 Maximum Product of Three Numbers Easy Solution
629 K Inverse Pairs Array Hard Solution
630 Course Schedule III Hard Solution
632 Smallest Range Covering Elements from K Lists Hard Solution
636 Exclusive Time of Functions Medium Solution
637 Average of Levels in Binary Tree Easy Solution
638 Shopping Offers Medium Solution
639 Decode Ways II Hard Solution
640 Solve the Equation Medium Solution
641 Design Circular Deque Medium Solution
643 Maximum Average Subarray I Easy Solution
645 Set Mismatch Easy Solution
646 Maximum Length of Pair Chain Medium Solution
647 Palindromic Substrings Medium Solution
648 Replace Words Medium Solution
649 Dota2 Senate Medium Solution
650 2 Keys Keyboard Medium Solution
651 4 Keys Keyboard Medium Solution
652 Find Duplicate Subtrees Medium Solution
653 Two Sum IV - Input is a BST Easy Solution
654 Maximum Binary Tree Medium Solution
655 Print Binary Tree Medium Solution
657 Robot Return to Origin Easy Solution
658 Find K Closest Elements Medium Solution
659 Split Array into Consecutive Subsequences Medium Solution
661 Image Smoother Easy Solution
662 Maximum Width of Binary Tree Medium Solution
663 Equal Tree Partition Medium Solution
664 Strange Printer Hard Solution
665 Non-decreasing Array Medium Solution
666 Path Sum IV Medium Solution
667 Beautiful Arrangement II Medium Solution
668 Kth Smallest Number in Multiplication Table Hard Solution
669 Trim a Binary Search Tree Medium Solution
670 Maximum Swap Medium Solution
671 Second Minimum Node In a Binary Tree Easy Solution
672 Bulb Switcher II Medium Solution
673 Number of Longest Increasing Subsequence Medium Solution
674 Longest Continuous Increasing Subsequence Easy Solution
675 Cut Off Trees for Golf Event Hard Solution
676 Implement Magic Dictionary Medium Solution
677 Map Sum Pairs Medium Solution
678 Valid Parenthesis String Medium Solution
679 24 Game Hard Solution
680 Valid Palindrome II Easy Solution
682 Baseball Game Easy Solution
684 Redundant Connection Medium Solution
685 Redundant Connection II Hard Solution
686 Repeated String Match Medium Solution
687 Longest Univalue Path Medium Solution
688 Knight Probability in Chessboard Medium Solution
689 Maximum Sum of 3 Non-Overlapping Subarrays Hard Solution
690 Employee Importance Easy Solution
691 Stickers to Spell Word Hard Solution
692 Top K Frequent Words Medium Solution
693 Binary Number with Alternating Bits Easy Solution
694 Number of Distinct Islands Medium Solution
695 Max Area of Island Medium Solution
696 Count Binary Substrings Easy Solution
697 Degree of an Array Easy Solution
698 Partition to K Equal Sum Subsets Medium Solution
699 Falling Squares Hard Solution
700 Search in a Binary Search Tree Easy Solution
701 Insert into a Binary Search Tree Medium Solution
702 Search in a Sorted Array of Unknown Size Medium Solution
703 Kth Largest Element in a Stream Easy Solution
704 Binary Search Easy Solution
705 Design HashSet Easy Solution
706 Design HashMap Easy Solution
707 Design Linked List Easy Solution
708 Insert into a Sorted Circular Linked List Medium Solution
709 To Lower Case Easy Solution
710 Random Pick with Blacklist Hard Solution
712 Minimum ASCII Delete Sum for Two Strings Medium Solution
713 Subarray Product Less Than K Medium Solution
714 Best Time to Buy and Sell Stock with Transaction Fee Medium Solution
715 Range Module Hard Solution
716 Max Stack Easy Solution
717 1-bit and 2-bit Characters Easy Solution
718 Maximum Length of Repeated Subarray Medium Solution
719 Find K-th Smallest Pair Distance Hard Solution
720 Longest Word in Dictionary Easy Solution
721 Accounts Merge Medium Solution
722 Remove Comments Medium Solution
723 Candy Crush Medium Solution
724 Find Pivot Index Easy Solution
725 Split Linked List in Parts Medium Solution
726 Number of Atoms Hard Solution
728 Self Dividing Numbers Easy Solution
729 My Calendar I Medium Solution
730 Count Different Palindromic Subsequences Hard Solution
731 My Calendar II Medium Solution
732 My Calendar III Hard Solution
733 Flood Fill Easy Solution
734 Sentence Similarity Easy Solution
735 Asteroid Collision Medium Solution
736 Parse Lisp Expression Hard Solution
738 Monotone Increasing Digits Medium Solution
739 Daily Temperatures Medium Solution
740 Delete and Earn Medium Solution
741 Cherry Pickup Hard Solution
743 Network Delay Time Medium Solution
744 Find Smallest Letter Greater Than Target Easy Solution
745 Prefix and Suffix Search Hard Solution
746 Min Cost Climbing Stairs Easy Solution
747 Largest Number At Least Twice of Others Easy Solution
748 Shortest Completing Word Easy Solution
749 Contain Virus Hard Solution
750 Number Of Corner Rectangles Medium Solution
751 IP to CIDR Hard Solution
752 Open the Lock Medium Solution
753 Cracking the Safe Hard Solution
754 Reach a Number Easy Solution
755 Pour Water Medium Solution
756 Pyramid Transition Matrix Medium Solution
757 Set Intersection Size At Least Two Hard Solution
758 Bold Words in String Medium Solution
759 Employee Free Time Hard Solution
760 Find Anagram Mappings Easy Solution
761 Special Binary String Hard Solution
762 Prime Number of Set Bits in Binary Representation Easy Solution
763 Partition Labels Medium Solution
764 Largest Plus Sign Medium Solution
765 Couples Holding Hands Hard Solution
766 Toeplitz Matrix Easy Solution
767 Reorganize String Medium Solution
768 Max Chunks To Make Sorted II Hard Solution
769 Max Chunks To Make Sorted Medium Solution
770 Basic Calculator IV Hard Solution
771 Jewels and Stones Easy Solution
772 Basic Calculator III Hard Solution
773 Sliding Puzzle Hard Solution
774 Minimize Max Distance to Gas Station Hard Solution
775 Global and Local Inversions Medium Solution
777 Swap Adjacent in LR String Medium Solution
778 Swim in Rising Water Hard Solution
779 K-th Symbol in Grammar Medium Solution
780 Reaching Points Hard Solution
781 Rabbits in Forest Medium Solution
783 Minimum Distance Between BST Nodes Medium Solution
784 Letter Case Permutation Easy Solution
785 Is Graph Bipartite? Medium Solution
786 K-th Smallest Prime Fraction Hard Solution
787 Cheapest Flights Within K Stops Medium Solution
788 Rotated Digits Easy Solution
789 Escape The Ghosts Medium Solution
790 Domino and Tromino Tiling Medium Solution
791 Custom Sort String Medium Solution
792 Number of Matching Subsequences Medium Solution
793 Preimage Size of Factorial Zeroes Function Hard Solution
794 Valid Tic-Tac-Toe State Medium Solution
795 Number of Subarrays with Bounded Maximum Medium Solution
796 Rotate String Easy Solution
797 All Paths From Source to Target Medium Solution
798 Smallest Rotation with Highest Score Hard Solution
799 Champagne Tower Medium Solution
800 Similar RGB Color Easy Solution
801 Minimum Swaps To Make Sequences Increasing Medium Solution
802 Find Eventual Safe States Medium Solution
804 Unique Morse Code Words Easy Solution
805 Split Array With Same Average Hard Solution
806 Number of Lines To Write String Easy Solution
807 Max Increase to Keep City Skyline Medium Solution
808 Soup Servings Medium Solution
809 Expressive Words Medium Solution
810 Chalkboard XOR Game Hard Solution
811 Subdomain Visit Count Easy Solution
812 Largest Triangle Area Easy Solution
813 Largest Sum of Averages Medium Solution
814 Binary Tree Pruning Medium Solution
815 Bus Routes Hard Solution
816 Ambiguous Coordinates Medium Solution
817 Linked List Components Medium Solution
818 Race Car Hard Solution
819 Most Common Word Easy Solution
820 Short Encoding of Words Medium Solution
821 Shortest Distance to a Character Easy Solution
822 Card Flipping Game Medium Solution
823 Binary Trees With Factors Medium Solution
824 Goat Latin Easy Solution
825 Friends Of Appropriate Ages Medium Solution
826 Most Profit Assigning Work Medium Solution
827 Making A Large Island Hard Solution
828 Unique Letter String Hard Solution
829 Consecutive Numbers Sum Hard Solution
830 Positions of Large Groups Easy Solution
831 Masking Personal Information Medium Solution
832 Flipping an Image Easy Solution
833 Find And Replace in String Medium Solution
834 Sum of Distances in Tree Hard Solution
835 Image Overlap Medium Solution
836 Rectangle Overlap Easy Solution
837 New 21 Game Medium Solution
838 Push Dominoes Medium Solution
839 Similar String Groups Hard Solution
840 Magic Squares In Grid Easy Solution
841 Keys and Rooms Medium Solution
842 Split Array into Fibonacci Sequence Medium Solution
843 Guess the Word Hard Solution
844 Backspace String Compare Easy Solution
845 Longest Mountain in Array Medium Solution
846 Hand of Straights Medium Solution
847 Shortest Path Visiting All Nodes Hard Solution
848 Shifting Letters Medium Solution
849 Maximize Distance to Closest Person Medium Solution
851 Loud and Rich Medium Solution
852 Peak Index in a Mountain Array Easy Solution
853 Car Fleet Medium Solution
854 K-Similar Strings Hard Solution
855 Exam Room Medium Solution
856 Score of Parentheses Medium Solution
857 Minimum Cost to Hire K Workers Hard Solution
858 Mirror Reflection Medium Solution
859 Buddy Strings Easy Solution
860 Lemonade Change Easy Solution
861 Score After Flipping Matrix Medium Solution
862 Shortest Subarray with Sum at Least K Hard Solution
863 All Nodes Distance K in Binary Tree Medium Solution
864 Shortest Path to Get All Keys Hard Solution
865 Smallest Subtree with all the Deepest Nodes Medium Solution
866 Prime Palindrome Medium Solution
867 Transpose Matrix Easy Solution
868 Binary Gap Easy Solution
869 Reordered Power of 2 Medium Solution
870 Advantage Shuffle Medium Solution
871 Minimum Number of Refueling Stops Hard Solution
872 Leaf-Similar Trees Easy Solution
873 Length of Longest Fibonacci Subsequence Medium Solution
874 Walking Robot Simulation Easy Solution
875 Koko Eating Bananas Medium Solution
876 Middle of the Linked List Easy Solution
877 Stone Game Medium Solution
878 Nth Magical Number Hard Solution
879 Profitable Schemes Hard Solution
880 Decoded String at Index Medium Solution
881 Boats to Save People Medium Solution
882 Reachable Nodes In Subdivided Graph Hard Solution
883 Projection Area of 3D Shapes Easy Solution
884 Uncommon Words from Two Sentences Easy Solution
885 Spiral Matrix III Medium Solution
886 Possible Bipartition Medium Solution
887 Super Egg Drop Hard Solution
888 Fair Candy Swap Easy Solution
889 Construct Binary Tree from Preorder and Postorder Traversal Medium Solution
890 Find and Replace Pattern Medium Solution
891 Sum of Subsequence Widths Hard Solution
892 Surface Area of 3D Shapes Easy Solution
893 Groups of Special-Equivalent Strings Easy Solution
894 All Possible Full Binary Trees Medium Solution
895 Maximum Frequency Stack Hard Solution
896 Monotonic Array Easy Solution
897 Increasing Order Search Tree Easy Solution
898 Bitwise ORs of Subarrays Medium Solution
899 Orderly Queue Hard Solution
900 RLE Iterator Medium Solution
901 Online Stock Span Medium Solution
902 Numbers At Most N Given Digit Set Hard Solution
903 Valid Permutations for DI Sequence Hard Solution
904 Fruit Into Baskets Medium Solution
905 Sort Array By Parity Easy Solution
906 Super Palindromes Hard Solution
907 Sum of Subarray Minimums Medium Solution
908 Smallest Range I Easy Solution
909 Snakes and Ladders Medium Solution
911 Online Election Medium Solution
912 Sort an Array Medium Solution
913 Cat and Mouse Hard Solution
914 X of a Kind in a Deck of Cards Easy Solution
915 Partition Array into Disjoint Intervals Medium Solution
916 Word Subsets Medium Solution
917 Reverse Only Letters Easy Solution
918 Maximum Sum Circular Subarray Medium Solution
919 Complete Binary Tree Inserter Medium Solution
920 Number of Music Playlists Hard Solution
921 Minimum Add to Make Parentheses Valid Medium Solution
922 Sort Array By Parity II Easy Solution
923 3Sum With Multiplicity Medium Solution
924 Minimize Malware Spread Hard Solution
925 Long Pressed Name Easy Solution
926 Flip String to Monotone Increasing Medium Solution
927 Three Equal Parts Hard Solution
928 Minimize Malware Spread II Hard Solution
929 Unique Email Addresses Easy Solution
930 Binary Subarrays With Sum Medium Solution
931 Minimum Falling Path Sum Medium Solution
932 Beautiful Array Medium Solution
933 Number of Recent Calls Easy Solution
934 Shortest Bridge Medium Solution
935 Knight Dialer Medium Solution
936 Stamping The Sequence Hard Solution
937 Reorder Log Files Easy Solution
938 Range Sum of BST Easy Solution
939 Minimum Area Rectangle Medium Solution
940 Distinct Subsequences II Hard Solution
941 Valid Mountain Array Easy Solution
942 DI String Match Easy Solution
943 Find the Shortest Superstring Hard Solution
944 Delete Columns to Make Sorted Easy Solution
945 Minimum Increment to Make Array Unique Medium Solution
946 Validate Stack Sequences Medium Solution
947 Most Stones Removed with Same Row or Column Medium Solution
948 Bag of Tokens Medium Solution
949 Largest Time for Given Digits Easy Solution
950 Reveal Cards In Increasing Order Medium Solution
951 Flip Equivalent Binary Trees Medium Solution
952 Largest Component Size by Common Factor Hard Solution
953 Verifying an Alien Dictionary Easy Solution
954 Array of Doubled Pairs Medium Solution
955 Delete Columns to Make Sorted II Medium Solution
956 Tallest Billboard Hard Solution
957 Prison Cells After N Days Medium Solution
958 Check Completeness of a Binary Tree Medium Solution
959 Regions Cut By Slashes Medium Solution
960 Delete Columns to Make Sorted III Hard Solution
961 N-Repeated Element in Size 2N Array Easy Solution
962 Maximum Width Ramp Medium Solution
963 Minimum Area Rectangle II Medium Solution
964 Least Operators to Express Number Hard Solution
967 Numbers With Same Consecutive Differences Medium Solution
968 Binary Tree Cameras Hard Solution
969 Pancake Sorting Medium Solution
970 Powerful Integers Easy Solution
971 Flip Binary Tree To Match Preorder Traversal Medium Solution
972 Equal Rational Numbers Hard Solution
973 K Closest Points to Origin Medium Solution
974 Subarray Sums Divisible by K Medium Solution
975 Odd Even Jump Hard Solution
977 Squares of a Sorted Array Easy Solution
978 Longest Turbulent Subarray Medium Solution
979 Distribute Coins in Binary Tree Medium Solution
980 Unique Paths III Hard Solution
981 Time Based Key-Value Store Medium Solution
982 Triples with Bitwise AND Equal To Zero Hard Solution
983 Minimum Cost For Tickets Medium Solution
984 String Without AAA or BBB Medium Solution
985 Sum of Even Numbers After Queries Easy Solution
986 Interval List Intersections Medium Solution
987 Vertical Order Traversal of a Binary Tree Medium Solution
988 Smallest String Starting From Leaf Medium Solution
989 Add to Array-Form of Integer Easy Solution
990 Satisfiability of Equality Equations Medium Solution
991 Broken Calculator Medium Solution
992 Subarrays with K Different Integers Hard Solution
993 Cousins in Binary Tree Easy Solution
994 Rotting Oranges Medium Solution
995 Minimum Number of K Consecutive Bit Flips Hard Solution
996 Number of Squareful Arrays Hard Solution
997 Find the Town Judge Easy Solution
998 Maximum Binary Tree II Medium Solution
999 Available Captures for Rook Easy Solution
1000 Minimum Cost to Merge Stones Hard Solution
1001 Grid Illumination Hard Solution
1002 Find Common Characters Easy Solution
1003 Check If Word Is Valid After Substitutions Medium Solution
1004 Max Consecutive Ones III Medium Solution
1005 Maximize Sum Of Array After K Negations Easy Solution
1006 Clumsy Factorial Medium Solution
1008 Construct Binary Search Tree from Preorder Traversal Medium Solution
1009 Complement of Base 10 Integer Easy Solution
1010 Pairs of Songs With Total Durations Divisible by 60 Medium Solution
1011 Capacity To Ship Packages Within D Days Medium Solution
1012 Complement of Base 10 Integer Easy Solution
1012 Numbers With Repeated Digits Hard Solution
1013 Partition Array Into Three Parts With Equal Sum Easy Solution
1014 Best Sightseeing Pair Medium Solution
1015 Smallest Integer Divisible by K Medium Solution
1016 Binary String With Substrings Representing 1 To N Medium Solution
1017 Convert to Base -2 Medium Solution
1018 Binary Prefix Divisible By 5 Easy Solution
1019 Next Greater Node In Linked List Medium Solution
1020 Number of Enclaves Medium Solution
1021 Remove Outermost Parentheses Easy Solution
1022 Sum of Root To Leaf Binary Numbers Easy Solution
1023 Camelcase Matching Medium Solution
1025 Divisor Game Easy Solution
1026 Maximum Difference Between Node and Ancestor Medium Solution
1027 Longest Arithmetic Sequence Medium Solution
1028 Recover a Tree From Preorder Traversal Hard Solution
1029 Two City Scheduling Medium Solution
1030 Matrix Cells in Distance Order Easy Solution
1031 Maximum Sum of Two Non-Overlapping Subarrays Medium Solution
1032 Stream of Characters Hard Solution
1033 Moving Stones Until Consecutive Easy Solution
1034 Coloring A Border Medium Solution
1035 Uncrossed Lines Medium Solution
1036 Escape a Large Maze Hard Solution
1037 Valid Boomerang Easy Solution
1038 Binary Search Tree to Greater Sum Tree Medium Solution
1039 Minimum Score Triangulation of Polygon Medium Solution
1040 Moving Stones Until Consecutive II Medium Solution
1041 Robot Bounded In Circle Medium Solution
1042 Flower Planting With No Adjacent Easy Solution
1043 Partition Array for Maximum Sum Medium Solution
1044 Longest Duplicate Substring Hard Solution
1046 Last Stone Weight Easy Solution
1047 Remove All Adjacent Duplicates In String Easy Solution
1048 Longest String Chain Medium Solution
1049 Last Stone Weight II Medium Solution
1051 Height Checker Easy Solution
1052 Grumpy Bookstore Owner Medium Solution
1053 Previous Permutation With One Swap Medium Solution
1054 Distant Barcodes Medium Solution
1055 Shortest Way to Form String Medium Solution
1056 Confusing Number Easy Solution
1057 Campus Bikes Medium Solution
1059 All Paths from Source Lead to Destination Medium Solution
1062 Longest Repeating Substring Medium Solution
1064 Fixed Point Easy Solution
1065 Index Pairs of a String Easy Solution
1071 Greatest Common Divisor of Strings Easy Solution
1072 Flip Columns For Maximum Number of Equal Rows Medium Solution
1073 Adding Two Negabinary Numbers Medium Solution
1074 Number of Submatrices That Sum to Target Hard Solution
1078 Occurrences After Bigram Easy Solution
1079 Letter Tile Possibilities Medium Solution
1080 Insufficient Nodes in Root to Leaf Paths Medium Solution
1081 Smallest Subsequence of Distinct Characters Medium Solution
1085 Sum of Digits in the Minimum Number Easy Solution
1086 High Five Easy Solution
1087 Brace Expansion Medium Solution
1089 Duplicate Zeros Easy Solution
1090 Largest Values From Labels Medium Solution
1091 Shortest Path in Binary Matrix Medium Solution
1092 Shortest Common Supersequence Hard Solution
1093 Statistics from a Large Sample Medium Solution
1094 Car Pooling Medium Solution
1095 Find in Mountain Array Hard Solution
1096 Brace Expansion II Hard Solution
1099 Two Sum Less Than K Easy Solution
1100 Find K-Length Substrings With No Repeated Characters Medium Solution
1101 The Earliest Moment When Everyone Become Friends Medium Solution
1102 Path With Maximum Minimum Value Medium Solution
1103 Distribute Candies to People Easy Solution
1104 Path In Zigzag Labelled Binary Tree Medium Solution
1105 Filling Bookcase Shelves Medium Solution
1106 Parsing A Boolean Expression Hard Solution
1108 Defanging an IP Address Easy Solution
1109 Corporate Flight Bookings Medium Solution
1110 Delete Nodes And Return Forest Medium Solution
1111 Maximum Nesting Depth of Two Valid Parentheses Strings Medium Solution
1118 Number of Days in a Month Easy Solution
1119 Remove Vowels from a String Easy Solution
1120 Maximum Average Subtree Medium Solution
1122 Relative Sort Array Easy Solution
1123 Lowest Common Ancestor of Deepest Leaves Medium Solution
1124 Longest Well-Performing Interval Medium Solution
1125 Smallest Sufficient Team Hard Solution
1128 Number of Equivalent Domino Pairs Easy Solution
1129 Shortest Path with Alternating Colors Medium Solution
1130 Minimum Cost Tree From Leaf Values Medium Solution
1131 Maximum of Absolute Value Expression Medium Solution
1133 Largest Unique Number Easy Solution
1134 Armstrong Number Easy Solution
1135 Connecting Cities With Minimum Cost Medium Solution
1136 Parallel Courses Medium Solution
1137 N-th Tribonacci Number Easy Solution
1138 Alphabet Board Path Medium Solution
1139 Largest 1-Bordered Square Medium Solution
1140 Stone Game II Medium Solution
1143 Longest Common Subsequence Medium Solution
1144 Decrease Elements To Make Array Zigzag Medium Solution
1145 Binary Tree Coloring Game Medium Solution
1146 Snapshot Array Medium Solution
1147 Longest Chunked Palindrome Decomposition Hard Solution
1150 Check If a Number Is Majority Element in a Sorted Array Easy Solution
1154 Day of the Year Easy Solution
1155 Number of Dice Rolls With Target Sum Medium Solution
1156 Swap For Longest Repeated Character Substring Medium Solution
1160 Find Words That Can Be Formed by Characters Easy Solution
1161 Maximum Level Sum of a Binary Tree Medium Solution
1162 As Far from Land as Possible Medium Solution
1163 Last Substring in Lexicographical Order Hard Solution
1165 Single-Row Keyboard Easy Solution
1166 Design File System Medium Solution
1167 Minimum Cost to Connect Sticks Medium Solution
1168 Optimize Water Distribution in a Village Hard Solution
1169 Invalid Transactions Medium Solution
1170 Compare Strings by Frequency of the Smallest Character Easy Solution
1171 Remove Zero Sum Consecutive Nodes from Linked List Medium Solution
1172 Dinner Plate Stacks Hard Solution
1175 Prime Arrangements Easy Solution
1176 Diet Plan Performance Easy Solution
1177 Can Make Palindrome from Substring Medium Solution
1178 Number of Valid Words for Each Puzzle Hard Solution
1180 Count Substrings with Only One Distinct Letter Easy Solution
1182 Shortest Distance to Target Color Medium Solution
1184 Distance Between Bus Stops Easy Solution
1185 Day of the Week Easy Solution
1186 Maximum Subarray Sum with One Deletion Medium Solution
1187 Make Array Strictly Increasing Hard Solution
1189 Maximum Number of Balloons Easy Solution
1190 Reverse Substrings Between Each Pair of Parentheses Medium Solution
1191 K-Concatenation Maximum Sum Medium Solution
1192 Critical Connections in a Network Hard Solution
1196 How Many Apples Can You Put into the Basket Easy Solution
1197 Minimum Knight Moves Medium Solution
1198 Find Smallest Common Element in All Rows Medium Solution
1200 Minimum Absolute Difference Easy Solution
1201 Ugly Number III Medium Solution
1202 Smallest String With Swaps Medium Solution
1203 Sort Items by Groups Respecting Dependencies Hard Solution
1206 Design Skiplist Hard Solution
1207 Unique Number of Occurrences Easy Solution
1208 Get Equal Substrings Within Budget Medium Solution
1209 Remove All Adjacent Duplicates in String II Medium Solution
1210 Minimum Moves to Reach Target with Rotations Hard Solution
1213 Intersection of Three Sorted Arrays Easy Solution
1214 Two Sum BSTs Medium Solution
1216 Valid Palindrome III Hard Solution
1217 Minimum Cost to Move Chips to The Same Position Easy Solution
1218 Longest Arithmetic Subsequence of Given Difference Medium Solution
1219 Path with Maximum Gold Medium Solution
1220 Count Vowels Permutation Hard Solution
1221 Split a String in Balanced Strings Easy Solution
1222 Queens That Can Attack the King Medium Solution
1223 Dice Roll Simulation Medium Solution
1224 Maximum Equal Frequency Hard Solution
1226 The Dining Philosophers Medium Solution
1227 Airplane Seat Assignment Probability Medium Solution
1228 Missing Number In Arithmetic Progression Easy Solution
1230 Toss Strange Coins Medium Solution
1231 Divide Chocolate Hard Solution
1232 Check If It Is a Straight Line Easy Solution
1233 Remove Sub-Folders from the Filesystem Medium Solution
1234 Replace the Substring for Balanced String Medium Solution
1235 Maximum Profit in Job Scheduling Hard Solution
1237 Find Positive Integer Solution for a Given Equation Easy Solution
1238 Circular Permutation in Binary Representation Medium Solution
1239 Maximum Length of a Concatenated String with Unique Characters Medium Solution
1240 Tiling a Rectangle with the Fewest Squares Hard Solution
1243 Array Transformation Easy Solution
1244 Design A Leaderboard Medium Solution
1245 Tree Diameter Medium Solution
1247 Minimum Swaps to Make Strings Equal Medium Solution
1248 Count Number of Nice Subarrays Medium Solution
1249 Minimum Remove to Make Valid Parentheses Medium Solution
1250 Check If It Is a Good Array Hard Solution
1252 Cells with Odd Values in a Matrix Easy Solution
1253 Reconstruct a 2-Row Binary Matrix Medium Solution
1254 Number of Closed Islands Medium Solution
1255 Maximum Score Words Formed by Letters Hard Solution
1256 Encode Number Medium Solution
1258 Synonymous Sentences Medium Solution
1260 Shift 2D Grid Easy Solution
1261 Find Elements in a Contaminated Binary Tree Medium Solution
1262 Greatest Sum Divisible by Three Medium Solution
1263 Minimum Moves to Move a Box to Their Target Location Hard Solution
1265 Print Immutable Linked List in Reverse Medium Solution
1266 Minimum Time Visiting All Points Easy Solution
1267 Count Servers that Communicate Medium Solution
1268 Search Suggestions System Medium Solution
1269 Number of Ways to Stay in the Same Place After Some Steps Hard Solution
1271 Hexspeak Easy Solution
1273 Delete Tree Nodes Medium Solution
1274 Number of Ships in a Rectangle Hard Solution
1275 Find Winner on a Tic Tac Toe Game Easy Solution
1276 Number of Burgers with No Waste of Ingredients Medium Solution
1277 Count Square Submatrices with All Ones Medium Solution
1278 Palindrome Partitioning III Hard Solution
1281 Subtract the Product and Sum of Digits of an Integer Easy Solution
1282 Group the People Given the Group Size They Belong To Medium Solution
1283 Find the Smallest Divisor Given a Threshold Medium Solution
1284 Minimum Number of Flips to Convert Binary Matrix to Zero Matrix Hard Solution
1286 Iterator for Combination Medium Solution
1287 Element Appearing More Than 25% In Sorted Array Easy Solution
1288 Remove Covered Intervals Medium Solution
1289 Minimum Falling Path Sum II Hard Solution
1290 Convert Binary Number in a Linked List to Integer Easy Solution
1291 Sequential Digits Medium Solution
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold Medium Solution
1293 Shortest Path in a Grid with Obstacles Elimination Hard Solution
1295 Find Numbers with Even Number of Digits Easy Solution
1296 Divide Array in Sets of K Consecutive Numbers Medium Solution
1297 Maximum Number of Occurrences of a Substring Medium Solution
1298 Maximum Candies You Can Get from Boxes Hard Solution
1299 Replace Elements with Greatest Element on Right Side Easy Solution
1300 Sum of Mutated Array Closest to Target Medium Solution
1301 Number of Paths with Max Score Hard Solution
1302 Deepest Leaves Sum Medium Solution
1304 Find N Unique Integers Sum up to Zero Easy Solution
1305 All Elements in Two Binary Search Trees Medium Solution
1306 Jump Game III Medium Solution
1307 Verbal Arithmetic Puzzle Hard Solution
1309 Decrypt String from Alphabet to Integer Mapping Easy Solution
1310 XOR Queries of a Subarray Medium Solution
1311 Get Watched Videos by Your Friends Medium Solution
1312 Minimum Insertion Steps to Make a String Palindrome Hard Solution
1313 Decompress Run-Length Encoded List Easy Solution
1314 Matrix Block Sum Medium Solution
1315 Sum of Nodes with Even-Valued Grandparent Medium Solution
1316 Distinct Echo Substrings Hard Solution
1317 Convert Integer to the Sum of Two No-Zero Integers Easy Solution
1318 Minimum Flips to Make a OR b Equal to c Medium Solution
1319 Number of Operations to Make Network Connected Medium Solution
1320 Minimum Distance to Type a Word Using Two Fingers Hard Solution
1323 Maximum 69 Number Easy Solution
1324 Print Words Vertically Medium Solution
1325 Delete Leaves With a Given Value Medium Solution
1326 Minimum Number of Taps to Open to Water a Garden Hard Solution
1328 Break a Palindrome Medium Solution
1329 Sort the Matrix Diagonally Medium Solution
1330 Reverse Subarray To Maximize Array Value Hard Solution
1331 Rank Transform of an Array Easy Solution
1332 Remove Palindromic Subsequences Easy Solution
1333 Filter Restaurants by Vegan-Friendly, Price and Distance Medium Solution
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance Medium Solution
1335 Minimum Difficulty of a Job Schedule Hard Solution
1337 The K Weakest Rows in a Matrix Easy Solution
1338 Reduce Array Size to The Half Medium Solution
1339 Maximum Product of Splitted Binary Tree Medium Solution
1340 Jump Game V Hard Solution
1341 The K Weakest Rows in a Matrix Easy Solution
1342 Number of Steps to Reduce a Number to Zero Easy Solution
1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Medium Solution
1344 Angle Between Hands of a Clock Medium Solution
1345 Jump Game IV Hard Solution
1346 Check If N and Its Double Exist Easy Solution
1347 Minimum Number of Steps to Make Two Strings Anagram Medium Solution
1348 Tweet Counts Per Frequency Medium Solution
1349 Maximum Students Taking Exam Hard Solution
1351 Count Negative Numbers in a Sorted Matrix Easy Solution
1352 Product of the Last K Numbers Medium Solution
1353 Maximum Number of Events That Can Be Attended Medium Solution
1354 Construct Target Array With Multiple Sums Hard Solution
1356 Sort Integers by The Number of 1 Bits Easy Solution
1357 Apply Discount Every n Orders Medium Solution
1358 Number of Substrings Containing All Three Characters Medium Solution
1359 Count All Valid Pickup and Delivery Options Hard Solution
1360 Number of Days Between Two Dates Easy Solution
1361 Validate Binary Tree Nodes Medium Solution
1363 Largest Multiple of Three Hard Solution
1367 Linked List in Binary Tree Medium Solution
1368 Minimum Cost to Make at Least One Valid Path in a Grid Hard Solution
1370 Increasing Decreasing String Easy Solution
1371 Find the Longest Substring Containing Vowels in Even Counts Medium Solution
1372 Longest ZigZag Path in a Binary Tree Medium Solution
1373 Maximum Sum BST in Binary Tree Hard Solution
1374 Generate a String With Characters That Have Odd Counts Easy Solution
1375 Bulb Switcher III Medium Solution
1376 Time Needed to Inform All Employees Medium Solution
1377 Frog Position After T Seconds Hard Solution
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Medium Solution
1380 Lucky Numbers in a Matrix Easy Solution
1381 Design a Stack With Increment Operation Medium Solution
1382 Balance a Binary Search Tree Medium Solution
1383 Maximum Performance of a Team Hard Solution
1385 Find the Distance Value Between Two Arrays Easy Solution
1386 Cinema Seat Allocation Medium Solution
1387 Sort Integers by The Power Value Medium Solution
1388 Pizza With 3n Slices Hard Solution
1389 Create Target Array in the Given Order Easy Solution
1390 Four Divisors Medium Solution
1391 Check if There is a Valid Path in a Grid Medium Solution
1392 Longest Happy Prefix Hard Solution
1396 Design Underground System Medium Solution
1397 Find All Good Strings Hard Solution
1399 Count Largest Group Easy Solution
1400 Construct K Palindrome Strings Medium Solution
1401 Circle and Rectangle Overlapping Medium Solution
1402 Reducing Dishes Hard Solution
1403 Minimum Subsequence in Non-Increasing Order Easy Solution
1404 Number of Steps to Reduce a Number in Binary Representation to One Medium Solution
1405 Longest Happy String Medium Solution
1406 Stone Game III Hard Solution
1408 String Matching in an Array Easy Solution
1409 Queries on a Permutation With Key Medium Solution
1410 HTML Entity Parser Medium Solution
1411 Number of Ways to Paint N × 3 Grid Hard Solution
1413 Minimum Value to Get Positive Step by Step Sum Easy Solution
1414 Find the Minimum Number of Fibonacci Numbers Whose Sum Is K Medium Solution
1415 The k-th Lexicographical String of All Happy Strings of Length n Medium Solution
1416 Restore The Array Hard Solution
1419 Minimum Number of Frogs Croaking Medium Solution
1420 Build Array Where You Can Find The Maximum Exactly K Comparisons Hard Solution
1422 Maximum Score After Splitting a String Easy Solution
1423 Maximum Points You Can Obtain from Cards Medium Solution
1424 Diagonal Traverse II Medium Solution
1425 Constrained Subsequence Sum Hard Solution
1428 Leftmost Column with at Least a One Medium Solution
1429 First Unique Number Medium Solution
1430 Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree Medium Solution
1434 Number of Ways to Wear Different Hats to Each Other Hard Solution
1436 Destination City Easy Solution
1437 Check If All 1's Are at Least Length K Places Away Medium Solution
1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Medium Solution
1439 Find the Kth Smallest Sum of a Matrix With Sorted Rows Hard Solution
1441 Build an Array With Stack Operations Solution
1442 Count Triplets That Can Form Two Arrays of Equal XOR Medium Solution
1443 Minimum Time to Collect All Apples in a Tree Medium Solution
1444 Number of Ways of Cutting a Pizza Hard Solution
1446 Consecutive Characters Easy Solution
1447 Simplified Fractions Medium Solution
1448 Count Good Nodes in Binary Tree Medium Solution
1449 Form Largest Integer With Digits That Add up to Target Hard Solution
1452 People Whose List of Favorite Companies Is Not a Subset of Another List Medium Solution
1453 Maximum Number of Darts Inside of a Circular Dartboard Hard Solution
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence Easy Solution
1456 Maximum Number of Vowels in a Substring of Given Length Medium Solution
1457 Pseudo-Palindromic Paths in a Binary Tree Medium Solution
1458 Max Dot Product of Two Subsequences Hard Solution
1460 Make Two Arrays Equal by Reversing Sub-arrays Easy Solution
1461 Check If a String Contains All Binary Codes of Size K Medium Solution
1462 Course Schedule IV Medium Solution
1463 Cherry Pickup II Hard Solution
1464 Maximum Product of Two Elements in an Array Easy Solution
1467 Probability of a Two Boxes Having The Same Number of Distinct Balls Hard Solution
1469 Find All The Lonely Nodes Easy Solution
1470 Shuffle the Array Easy Solution
1471 The k Strongest Values in an Array Medium Solution
1472 Design Browser History Medium Solution
1473 Paint House III Hard Solution
1474 Delete N Nodes After M Nodes of a Linked List Easy Solution
1475 Final Prices With a Special Discount in a Shop Easy Solution
1476 Subrectangle Queries Medium Solution
1477 Find Two Non-overlapping Sub-arrays Each With Target Sum Medium Solution
1478 Allocate Mailboxes Hard Solution
1480 Running Sum of 1d Array Easy Solution
1481 Least Number of Unique Integers after K Removals Medium Solution
1482 Minimum Number of Days to Make m Bouquets Medium Solution
1483 Kth Ancestor of a Tree Node Hard Solution
1485 Clone Binary Tree With Random Pointer Medium Solution
1486 XOR Operation in an Array Easy Solution
1487 Making File Names Unique Medium Solution
1488 Avoid Flood in The City Medium Solution
1489 Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree Hard Solution
1490 Clone N-ary Tree Medium Solution
1491 Average Salary Excluding the Minimum and Maximum Salary Easy Solution
1492 The kth Factor of n Medium Solution
1493 Longest Subarray of 1's After Deleting One Element Medium Solution
1494 Parallel Courses II Hard Solution
1496 Path Crossing Easy Solution
1497 Check If Array Pairs Are Divisible by k Medium Solution
1498 Number of Subsequences That Satisfy the Given Sum Condition Medium Solution
1499 Max Value of Equation Hard Solution
1502 Can Make Arithmetic Progression From Sequence Easy Solution
1503 Last Moment Before All Ants Fall Out of a Plank Medium Solution
1504 Count Submatrices With All Ones Medium Solution
1505 Minimum Possible Integer After at Most K Adjacent Swaps On Digits Hard Solution
1506 Find Root of N-Ary Tree Medium Solution
1507 Reformat Date Easy Solution
1508 Range Sum of Sorted Subarray Sums Medium Solution
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Medium Solution
1510 Stone Game IV Hard Solution
1512 Number of Good Pairs Easy Solution
1513 Number of Substrings With Only 1s Medium Solution
1514 Path with Maximum Probability Medium Solution
1515 Best Position for a Service Centre Hard Solution
1518 Water Bottles Easy Solution
1519 Number of Nodes in the Sub-Tree With the Same Label Medium Solution
1520 Maximum Number of Non-Overlapping Substrings Medium Solution
1521 Find a Value of a Mysterious Function Closest to Target Hard Solution
1522 Diameter of N-Ary Tree Medium Solution
1523 Count Odd Numbers in an Interval Range Easy Solution
1524 Number of Sub-arrays With Odd Sum Medium Solution
1525 Number of Good Ways to Split a String Medium Solution
1526 Minimum Number of Increments on Subarrays to Form a Target Array Hard Solution
1531 String Compression II Hard Solution
1534 Count Good Triplets Easy Solution
1535 Find the Winner of an Array Game Medium Solution
1536 Minimum Swaps to Arrange a Binary Grid Medium Solution
1537 Get the Maximum Score Hard Solution
1539 Kth Missing Positive Number Easy Solution
1540 Can Convert String in K Moves Medium Solution
1541 Minimum Insertions to Balance a Parentheses String Medium Solution
1542 Find Longest Awesome Substring Hard Solution
1544 Make The String Great Easy Solution
1545 Find Kth Bit in Nth Binary String Medium Solution
1546 Maximum Number of Non-Overlapping Subarrays With Sum Equals Target Medium Solution
1547 Minimum Cost to Cut a Stick Hard Solution
1550 Three Consecutive Odds Easy Solution
1551 Minimum Operations to Make Array Equal Medium Solution
1552 Magnetic Force Between Two Balls Medium Solution
1553 Minimum Number of Days to Eat N Oranges Hard Solution
1554 Strings Differ by One Character Medium Solution
1556 Thousand Separator Easy Solution
1557 Minimum Number of Vertices to Reach All Nodes Medium Solution
1558 Minimum Numbers of Function Calls to Make Target Array Medium Solution
1559 Detect Cycles in 2D Grid Solution
1560 Most Visited Sector in a Circular Track Easy Solution
1561 Maximum Number of Coins You Can Get Medium Solution
1562 Find Latest Group of Size M Medium Solution
1563 Stone Game V Hard Solution
1564 Put Boxes Into the Warehouse I Medium Solution
1566 Detect Pattern of Length M Repeated K or More Times Easy Solution
1567 Maximum Length of Subarray With Positive Product Medium Solution
1568 Minimum Number of Days to Disconnect Island Medium Solution
1569 Number of Ways to Reorder Array to Get Same BST Hard Solution
1570 Dot Product of Two Sparse Vectors Medium Solution
1572 Matrix Diagonal Sum Easy Solution
1573 Number of Ways to Split a String Medium Solution
1574 Shortest Subarray to be Removed to Make Array Sorted Medium Solution
1575 Count All Possible Routes Hard Solution
1576 Replace All ?'s to Avoid Consecutive Repeating Characters Easy Solution
1577 Number of Ways Where Square of Number Is Equal to Product of Two Numbers Medium Solution
1578 Minimum Deletion Cost to Avoid Repeating Letters Medium Solution
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Hard Solution
1580 Put Boxes Into the Warehouse II Medium Solution
1582 Special Positions in a Binary Matrix Easy Solution
1583 Count Unhappy Friends Medium Solution
1584 Min Cost to Connect All Points Medium Solution
1585 Check If String Is Transformable With Substring Sort Operations Hard Solution
1586 Binary Search Tree Iterator II Medium Solution
1588 Sum of All Odd Length Subarrays Easy Solution
1589 Maximum Sum Obtained of Any Permutation Medium Solution
1590 Make Sum Divisible by P Medium Solution
1591 Strange Printer II Hard Solution
1592 Rearrange Spaces Between Words Easy Solution
1593 Split a String Into the Max Number of Unique Substrings Medium Solution
1594 Maximum Non Negative Product in a Matrix Medium Solution
1595 Minimum Cost to Connect Two Groups of Points Hard Solution
1598 Crawler Log Folder Easy Solution
1599 Maximum Profit of Operating a Centennial Wheel Medium Solution
1600 Throne Inheritance Medium Solution
1601 Maximum Number of Achievable Transfer Requests Hard Solution
1602 Find Nearest Right Node in Binary Tree Medium Solution
1603 Design Parking System Easy Solution
1604 Alert Using Same Key-Card Three or More Times in a One Hour Period Medium Solution
1605 Find Valid Matrix Given Row and Column Sums Medium Solution
1606 Find Servers That Handled Most Number of Requests Hard Solution
1608 Special Array With X Elements Greater Than or Equal X Easy Solution
1609 Even Odd Tree Medium Solution
1610 Maximum Number of Visible Points Medium Solution
1611 Minimum One Bit Operations to Make Integers Zero Hard Solution
1614 Maximum Nesting Depth of the Parentheses Easy Solution
1615 Maximal Network Rank Medium Solution
1616 Split Two Strings to Make Palindrome Medium Solution
1617 Count Subtrees With Max Distance Between Cities Hard Solution
1619 Mean of Array After Removing Some Elements Easy Solution
1620 Coordinate With Maximum Network Quality Medium Solution
1621 Number of Sets of K Non-Overlapping Line Segments Medium Solution
1622 Fancy Sequence Hard Solution
1624 Largest Substring Between Two Equal Characters Easy Solution
1625 Lexicographically Smallest String After Applying Operations Medium Solution
1626 Best Team With No Conflicts Medium Solution
1627 Graph Connectivity With Threshold Hard Solution
1629 Slowest Key Easy Solution
1631 Path With Minimum Effort Medium Solution
1632 Rank Transform of a Matrix Hard Solution
1636 Sort Array by Increasing Frequency Easy Solution
1637 Widest Vertical Area Between Two Points Containing No Points Medium Solution
1638 Count Substrings That Differ by One Character Medium Solution
1639 Number of Ways to Form a Target String Given a Dictionary Hard Solution
1640 Check Array Formation Through Concatenation Easy Solution
1641 Count Sorted Vowel Strings Medium Solution
1642 Furthest Building You Can Reach Medium Solution
1643 Kth Smallest Instructions Hard Solution
1644 Lowest Common Ancestor of a Binary Tree II Medium Solution
1647 Minimum Deletions to Make Character Frequencies Unique Medium Solution
1648 Sell Diminishing-Valued Colored Balls Medium Solution
1649 Create Sorted Array through Instructions Hard Solution
1650 Lowest Common Ancestor of a Binary Tree III Medium Solution
1653 Minimum Deletions to Make String Balanced Medium Solution
1654 Minimum Jumps to Reach Home Medium Solution
1657 Determine if Two Strings Are Close Medium Solution
1658 Minimum Operations to Reduce X to Zero Medium Solution
1659 Maximize Grid Happiness Hard Solution
1660 Correct a Binary Tree Medium Solution
1662 Check If Two String Arrays are Equivalent Easy Solution
1663 Smallest String With A Given Numeric Value Medium Solution
1664 Ways to Make a Fair Array Medium Solution
1665 Minimum Initial Energy to Finish Tasks Hard Solution
1668 Maximum Repeating Substring Easy Solution
1669 Merge In Between Linked Lists Medium Solution
1670 Design Front Middle Back Queue Medium Solution
1671 Minimum Number of Removals to Make Mountain Array Hard Solution
1672 Richest Customer Wealth Easy Solution
1673 Find the Most Competitive Subsequence Medium Solution
1674 Minimum Moves to Make Array Complementary Medium Solution
1675 Minimize Deviation in Array Hard Solution
1676 Lowest Common Ancestor of a Binary Tree IV Medium Solution
1678 Goal Parser Interpretation Easy Solution
1679 Max Number of K-Sum Pairs Medium Solution
1680 Concatenation of Consecutive Binary Numbers Medium Solution
1681 Minimum Incompatibility Hard Solution
1685 Sum of Absolute Differences in a Sorted Array Medium Solution
1687 Delivering Boxes from Storage to Ports Hard Solution
1688 Count of Matches in Tournament Easy Solution
1689 Partitioning Into Minimum Number Of Deci-Binary Numbers Medium Solution
1690 Stone Game VII Medium Solution
1691 Maximum Height by Stacking Cuboids Hard Solution
1694 Reformat Phone Number Easy Solution
1695 Maximum Erasure Value Medium Solution
1696 Jump Game VI Medium Solution
1697 Checking Existence of Edge Length Limited Paths Hard Solution
1698 Number of Distinct Substrings in a String Medium Solution
1700 Number of Students Unable to Eat Lunch Easy Solution
1701 Average Waiting Time Medium Solution
1702 Maximum Binary String After Change Medium Solution
1704 Determine if String Halves Are Alike Easy Solution
1705 Maximum Number of Eaten Apples Medium Solution
1706 Where Will the Ball Fall Medium Solution
1707 Maximum XOR With an Element From Array Hard Solution
1708 Largest Subarray Length K Easy Solution
1710 Maximum Units on a Truck Easy Solution
1711 Count Good Meals Medium Solution
1712 Ways to Split Array Into Three Subarrays Medium Solution
1713 Minimum Operations to Make a Subsequence Hard Solution
1716 Calculate Money in Leetcode Bank Easy Solution
1717 Maximum Score From Removing Substrings Medium Solution
1718 Construct the Lexicographically Largest Valid Sequence Medium Solution
1719 Number Of Ways To Reconstruct A Tree Hard Solution
1720 Decode XORed Array Easy Solution
1721 Swapping Nodes in a Linked List Medium Solution
1722 Minimize Hamming Distance After Swap Operations Medium Solution
1723 Find Minimum Time to Finish All Jobs Hard Solution
1727 Largest Submatrix With Rearrangements Medium Solution
1730 Shortest Path to Get Food Medium Solution
1732 Find the Highest Altitude Easy Solution
1733 Minimum Number of People to Teach Medium Solution
1734 Decode XORed Permutation Medium Solution
1735 Count Ways to Make Array With Product Hard Solution
1736 Latest Time by Replacing Hidden Digits Easy Solution
1737 Change Minimum Characters to Satisfy One of Three Conditions Medium Solution
1738 Find Kth Largest XOR Coordinate Value Medium Solution
1739 Building Boxes Hard Solution
1740 Find Distance in a Binary Tree Medium Solution
1744 Can You Eat Your Favorite Candy on Your Favorite Day? Medium Solution
1745 Palindrome Partitioning IV Hard Solution
1748 Sum of Unique Elements Easy Solution
1749 Maximum Absolute Sum of Any Subarray Medium Solution
1750 Minimum Length of String After Deleting Similar Ends Medium Solution
1751 Maximum Number of Events That Can Be Attended II Hard Solution
1754 Largest Merge Of Two Strings Medium Solution
1755 Closest Subsequence Sum Hard Solution
1762 Buildings With an Ocean View Medium Solution
1763 Longest Nice Substring Easy Solution
1764 Form Array by Concatenating Subarrays of Another Array Medium Solution
1765 Map of Highest Peak Medium Solution
1766 Tree of Coprimes Hard Solution
1768 Merge Strings Alternately Easy Solution
1769 Minimum Number of Operations to Move All Balls to Each Box Medium Solution
1770 Maximum Score from Performing Multiplication Operations Medium Solution
1771 Maximize Palindrome Length From Subsequences Hard Solution
1772 Sort Features by Popularity Medium Solution
1773 Count Items Matching a Rule Easy Solution
1774 Closest Dessert Cost Medium Solution
1775 Equal Sum Arrays With Minimum Number of Operations Medium Solution
1779 Find Nearest Point That Has the Same X or Y Coordinate Easy Solution
1780 Check if Number is a Sum of Powers of Three Medium Solution
1781 Sum of Beauty of All Substrings Medium Solution
1784 Check if Binary String Has at Most One Segment of Ones Easy Solution
1785 Minimum Elements to Add to Form a Given Sum Medium Solution
1786 Number of Restricted Paths From First to Last Node Medium Solution
1787 Make the XOR of All Segments Equal to Zero Hard Solution
1790 Check if One String Swap Can Make Strings Equal Easy Solution
1791 Find Center of Star Graph Medium Solution
1792 Maximum Average Pass Ratio Medium Solution
1793 Maximum Score of a Good Subarray Hard Solution
1796 Second Largest Digit in a String Easy Solution
1797 Design Authentication Manager Medium Solution
1798 Maximum Number of Consecutive Values You Can Make Medium Solution
1799 Maximize Score After N Operations Hard Solution
1800 Maximum Ascending Subarray Sum Easy Solution
1801 Number of Orders in the Backlog Medium Solution
1802 Maximum Value at a Given Index in a Bounded Array Medium Solution
1803 Count Pairs With XOR in a Range Hard Solution
1804 Implement Trie II (Prefix Tree) Medium Solution
1806 Minimum Number of Operations to Reinitialize a Permutation Medium Solution
1807 Evaluate the Bracket Pairs of a String Medium Solution
1808 Maximize Number of Nice Divisors Hard Solution
1810 Minimum Path Cost in a Hidden Grid Medium Solution
1812 Determine Color of a Chessboard Square Easy Solution
1813 Sentence Similarity III Medium Solution
1814 Count Nice Pairs in an Array Medium Solution
1815 Maximum Number of Groups Getting Fresh Donuts Hard Solution
1816 Truncate Sentence Easy Solution
1817 Finding the Users Active Minutes Medium Solution
1818 Minimum Absolute Sum Difference Medium Solution
1819 Number of Different Subsequences GCDs Hard Solution
1820 Maximum Number of Accepted Invitations Medium Solution
1822 Sign of the Product of an Array Easy Solution
1823 Find the Winner of the Circular Game Medium Solution
1824 Minimum Sideway Jumps Medium Solution
1825 Finding MK Average Hard Solution
1826 Faulty Sensor Easy Solution
1827 Minimum Operations to Make the Array Increasing Easy Solution
1828 Queries on Number of Points Inside a Circle Medium Solution
1829 Maximum XOR for Each Query Medium Solution
1830 Minimum Number of Operations to Make String Sorted Hard Solution
1832 Check if the Sentence Is Pangram Easy Solution
1833 Maximum Ice Cream Bars Medium Solution
1834 Single-Threaded CPU Medium Solution
1835 Find XOR Sum of All Pairs Bitwise AND Hard Solution
1836 Remove Duplicates From an Unsorted Linked List Medium Solution
1837 Sum of Digits in Base K Easy Solution
1838 Frequency of the Most Frequent Element Medium Solution
1839 Longest Substring Of All Vowels in Order Medium Solution
1840 Maximum Building Height Hard Solution
1844 Replace All Digits with Characters Easy Solution
1845 Seat Reservation Manager Medium Solution
1846 Maximum Element After Decreasing and Rearranging Medium Solution
1847 Closest Room Hard Solution
1848 Minimum Distance to the Target Element Easy Solution
1849 Splitting a String Into Descending Consecutive Values Medium Solution
1850 Minimum Adjacent Swaps to Reach the Kth Smallest Number Medium Solution
1851 Minimum Interval to Include Each Query Hard Solution
1852 Distinct Numbers in Each Subarray Medium Solution
1854 Maximum Population Year Easy Solution
1855 Maximum Distance Between a Pair of Values Medium Solution
1856 Maximum Subarray Min-Product Medium Solution
1857 Largest Color Value in a Directed Graph Hard Solution
1858 Longest Word With All Prefixes Medium Solution
1859 Sorting the Sentence Easy Solution
1860 Incremental Memory Leak Medium Solution
1861 Rotating the Box Medium Solution
1862 Sum of Floored Pairs Hard Solution
1863 Sum of All Subset XOR Totals Easy Solution
1864 Minimum Number of Swaps to Make the Binary String Alternating Medium Solution
1865 Finding Pairs With a Certain Sum Medium Solution
1866 Number of Ways to Rearrange Sticks With K Sticks Visible Hard Solution
1869 Longer Contiguous Segments of Ones than Zeros Easy Solution
1870 Minimum Speed to Arrive on Time Medium Solution
1871 Jump Game VII Medium Solution
1872 Stone Game VIII Hard Solution
1874 Minimize Product Sum of Two Arrays Medium Solution
1876 Substrings of Size Three with Distinct Characters Easy Solution
1877 Minimize Maximum Pair Sum in Array Medium Solution
1878 Get Biggest Three Rhombus Sums in a Grid Medium Solution
1879 Minimum XOR Sum of Two Arrays Hard Solution
1880 Check if Word Equals Summation of Two Words Easy Solution
1881 Maximum Value after Insertion Medium Solution
1882 Process Tasks Using Servers Medium Solution
1883 Minimum Skips to Arrive at Meeting On Time Hard Solution
1884 Egg Drop With 2 Eggs and N Floors Medium Solution
1886 Determine Whether Matrix Can Be Obtained By Rotation Easy Solution
1887 Reduction Operations to Make the Array Elements Equal Medium Solution
1888 Minimum Number of Flips to Make the Binary String Alternating Medium Solution
1889 Minimum Space Wasted From Packaging Hard Solution
1893 Check if All the Integers in a Range Are Covered Easy Solution
1894 Find the Student that Will Replace the Chalk Medium Solution
1895 Largest Magic Square Medium Solution
1896 Minimum Cost to Change the Final Value of Expression Hard Solution
1897 Redistribute Characters to Make All Strings Equal Easy Solution
1898 Maximum Number of Removable Characters Medium Solution
1899 Merge Triplets to Form Target Triplet Medium Solution
1900 The Earliest and Latest Rounds Where Players Compete Hard Solution
1901 Find a Peak Element II Medium Solution
1902 Depth of BST Given Insertion Order Medium Solution
1903 Largest Odd Number in String Easy Solution
1904 The Number of Full Rounds You Have Played Medium Solution
1905 Count Sub Islands Medium Solution
1906 Minimum Absolute Difference Queries Medium Solution
1909 Remove One Element to Make the Array Strictly Increasing Easy Solution
1910 Remove All Occurrences of a Substring Medium Solution
1911 Maximum Alternating Subsequence Sum Medium Solution
1912 Design Movie Rental System Hard Solution
1913 Maximum Product Difference Between Two Pairs Easy Solution
1914 Cyclically Rotating a Grid Medium Solution
1915 Number of Wonderful Substrings Medium Solution
1920 Build Array from Permutation Easy Solution
1921 Eliminate Maximum Number of Monsters Medium Solution
1922 Count Good Numbers Medium Solution
1923 Longest Common Subpath Hard Solution
1925 Count Square Sum Triples Easy Solution
1926 Nearest Exit from Entrance in Maze Medium Solution
1927 Sum Game Medium Solution
1928 Minimum Cost to Reach Destination in Time Hard Solution
1929 Concatenation of Array Easy Solution
1930 Unique Length-3 Palindromic Subsequences Medium Solution
1931 Painting a Grid With Three Different Colors Hard Solution
1933 Check if String Is Decomposable Into Value-Equal Substrings Easy Solution
1935 Maximum Number of Words You Can Type Easy Solution
1936 Add Minimum Number of Rungs Medium Solution
1937 Maximum Number of Points with Cost Medium Solution
1938 Maximum Genetic Difference Query Hard Solution
1940 Longest Common Subsequence Between Sorted Arrays Medium Solution
1941 Check if All Characters Have Equal Number of Occurrences Easy Solution
1942 The Number of the Smallest Unoccupied Chair Medium Solution
1943 Describe the Painting Medium Solution
1944 Number of Visible People in a Queue Hard Solution
1945 Sum of Digits of String After Convert Easy Solution
1946 Largest Number After Mutating Substring Medium Solution
1947 Maximum Compatibility Score Sum Solution
1948 Delete Duplicate Folders in System Hard Solution
1952 Three Divisors Easy Solution
1953 Maximum Number of Weeks for Which You Can Work Medium Solution
1954 Minimum Garden Perimeter to Collect Enough Apples Medium Solution
1955 Count Number of Special Subsequences Hard Solution
1957 Delete Characters to Make Fancy String Easy Solution
1958 Check if Move is Legal Medium Solution
1959 Minimum Total Space Wasted With K Resizing Operations Medium Solution
1960 Maximum Product of the Length of Two Palindromic Substrings Hard Solution
1961 Check If String Is a Prefix of Array Easy Solution
1962 Remove Stones to Minimize the Total Medium Solution
1963 Minimum Number of Swaps to Make the String Balanced Medium Solution
1964 Find the Longest Valid Obstacle Course at Each Position Hard Solution
1967 Number of Strings That Appear as Substrings in Word Easy Solution
1968 Array With Elements Not Equal to Average of Neighbors Medium Solution
1969 Minimum Non-Zero Product of the Array Elements Medium Solution
1971 Find if Path Exists in Graph Easy Solution
1973 Count Nodes Equal to Sum of Descendants Medium Solution
1974 Minimum Time to Type Word Using Special Typewriter Easy Solution
1975 Maximum Matrix Sum Medium Solution
1976 Number of Ways to Arrive at Destination Medium Solution
1977 Number of Ways to Separate Numbers Hard Solution
1979 Find Greatest Common Divisor of Array Easy Solution
1980 Find Unique Binary String Medium Solution
1981 Minimize the Difference Between Target and Chosen Elements Medium Solution
1982 Find Array Given Subset Sums Hard Solution
1984 Minimum Difference Between Highest and Lowest of K Scores Easy Solution
1985 Find the Kth Largest Integer in the Array Medium Solution
1986 Minimum Number of Work Sessions to Finish the Tasks Medium Solution
1987 Number of Unique Good Subsequences Hard Solution
1991 Find the Middle Index in Array Easy Solution
1992 Find All Groups of Farmland Medium Solution
1993 Operations on Tree Medium Solution
1994 The Number of Good Subsets Hard Solution
1995 Count Special Quadruplets Easy Solution
1996 The Number of Weak Characters in the Game Medium Solution
1997 First Day Where You Have Been in All the Rooms Medium Solution
1998 GCD Sort of an Array Hard Solution
2000 Reverse Prefix of Word Easy Solution
2001 Number of Pairs of Interchangeable Rectangles Medium Solution
2002 Maximum Product of the Length of Two Palindromic Subsequences Medium Solution
2003 Smallest Missing Genetic Value in Each Subtree Hard Solution
2006 Count Number of Pairs With Absolute Difference K Easy Solution
2007 Find Original Array From Doubled Array Medium Solution
2008 Maximum Earnings From Taxi Medium Solution
2009 Minimum Number of Operations to Make Array Continuous Hard Solution
2011 Final Value of Variable After Performing Operations Easy Solution
2012 Sum of Beauty in the Array Medium Solution
2013 Detect Squares Medium Solution
2014 Longest Subsequence Repeated k Times Hard Solution
2016 Maximum Difference Between Increasing Elements Easy Solution
2017 Grid Game Medium Solution
2018 Check if Word Can Be Placed In Crossword Medium Solution
2019 The Score of Students Solving Math Expression Hard Solution
2021 Brightest Position on Street Medium Solution
2022 Convert 1D Array Into 2D Array Easy Solution
2023 Number of Pairs of Strings With Concatenation Equal to Target Medium Solution
2024 Maximize the Confusion of an Exam Medium Solution
2025 Maximum Number of Ways to Partition an Array Hard Solution
2027 Minimum Moves to Convert String Easy Solution
2028 Find Missing Observations Medium Solution
2029 Stone Game IX Medium Solution
2030 Smallest K-Length Subsequence With Occurrences of a Letter Hard Solution
2031 Count Subarrays With More Ones Than Zeros Medium Solution
2032 Two Out of Three Easy Solution
2033 Minimum Operations to Make a Uni-Value Grid Medium Solution
2034 Stock Price Fluctuation Medium Solution
2035 Partition Array Into Two Arrays to Minimize Sum Difference Hard Solution
2037 Minimum Number of Moves to Seat Everyone Easy Solution
2038 Remove Colored Pieces if Both Neighbors are the Same Color Medium Solution
2039 The Time When the Network Becomes Idle Medium Solution
2040 Kth Smallest Product of Two Sorted Arrays Hard Solution
2042 Check if Numbers Are Ascending in a Sentence Easy Solution
2043 Simple Bank System Medium Solution
2044 Count Number of Maximum Bitwise-OR Subsets Medium Solution
2045 Second Minimum Time to Reach Destination Hard Solution
2046 Sort Linked List Already Sorted Using Absolute Values Medium Solution
2047 Number of Valid Words in a Sentence Easy Solution
2048 Next Greater Numerically Balanced Number Medium Solution
2049 Count Nodes With the Highest Score Medium Solution
2050 Parallel Courses III Hard Solution
2053 Kth Distinct String in an Array Easy Solution
2054 Two Best Non-Overlapping Events Medium Solution
2055 Plates Between Candles Medium Solution
2056 Number of Valid Move Combinations On Chessboard Hard Solution
2057 Smallest Index With Equal Value Easy Solution
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Medium Solution
2059 Minimum Operations to Convert Number Medium Solution
2060 Check if an Original String Exists Given Two Encoded Strings Hard Solution
2062 Count Vowel Substrings of a String Easy Solution
2063 Vowels of All Substrings Medium Solution
2064 Minimized Maximum of Products Distributed to Any Store Medium Solution
2065 Maximum Path Quality of a Graph Hard Solution
2068 Check Whether Two Strings are Almost Equivalent Easy Solution
2069 Walking Robot Simulation II Medium Solution
2070 Most Beautiful Item for Each Query Medium Solution
2071 Maximum Number of Tasks You Can Assign Hard Solution
2073 Time Needed to Buy Tickets Easy Solution
2074 Reverse Nodes in Even Length Groups Medium Solution
2075 Decode the Slanted Ciphertext Medium Solution
2076 Process Restricted Friend Requests Hard Solution
2077 Paths in Maze That Lead to Same Room Medium Solution
2078 Two Furthest Houses With Different Colors Easy Solution
2079 Watering Plants Medium Solution
2080 Range Frequency Queries Medium Solution
2081 Sum of k-Mirror Numbers Hard Solution
2083 Substrings That Begin and End With the Same Letter Medium Solution
2085 Count Common Words With One Occurrence Easy Solution
2086 Minimum Number of Buckets Required to Collect Rainwater from Houses Medium Solution
2087 Minimum Cost Homecoming of a Robot in a Grid Medium Solution
2088 Count Fertile Pyramids in a Land Hard Solution
2089 Find Target Indices After Sorting Array Easy Solution
2090 K Radius Subarray Averages Medium Solution
2091 Removing Minimum and Maximum From Array Medium Solution
2092 Find All People With Secret Hard Solution
2093 Minimum Cost to Reach City With Discounts Medium Solution
2094 Finding 3-Digit Even Numbers Easy Solution
2095 Delete the Middle Node of a Linked List Medium Solution
2096 Step-By-Step Directions From a Binary Tree Node to Another Medium Solution
2097 Valid Arrangement of Pairs Hard Solution
2099 Find Subsequence of Length K With the Largest Sum Easy Solution
2100 Find Good Days to Rob the Bank Medium Solution
2101 Detonate the Maximum Bombs Medium Solution
2102 Sequentially Ordinal Rank Tracker Hard Solution
2103 Rings and Rods Easy Solution
2104 Sum of Subarray Ranges Medium Solution
2105 Watering Plants II Medium Solution
2106 Maximum Fruits Harvested After at Most K Steps Hard Solution
2107 Number of Unique Flavors After Sharing K Candies Medium Solution
2108 Find First Palindromic String in the Array Easy Solution
2109 Adding Spaces to a String Medium Solution
2110 Number of Smooth Descent Periods of a Stock Medium Solution
2111 Minimum Operations to Make the Array K-Increasing Hard Solution
2114 Maximum Number of Words Found in Sentences Easy Solution
2115 Find All Possible Recipes from Given Supplies Medium Solution
2119 A Number After a Double Reversal Easy Solution
2120 Execution of All Suffix Instructions Staying in a Grid Medium Solution
2121 Intervals Between Identical Elements Medium Solution
2122 Recover the Original Array Hard Solution
2124 Check if All A's Appears Before All B's Easy Solution
2125 Number of Laser Beams in a Bank Medium Solution
2126 Destroying Asteroids Medium Solution
2127 Maximum Employees to Be Invited to a Meeting Hard Solution
2128 Remove All Ones With Row and Column Flips Medium Solution
2129 Capitalize the Title Easy Solution
2130 Maximum Twin Sum of a Linked List Medium Solution
2131 Longest Palindrome by Concatenating Two Letter Words Medium Solution
2138 Divide a String Into Groups of Size k Easy Solution
2139 Minimum Moves to Reach Target Score Medium Solution
2140 Solving Questions With Brainpower Medium Solution
2144 Minimum Cost of Buying Candies With Discount Easy Solution
2145 Count the Hidden Sequences Medium Solution
2146 K Highest Ranked Items Within a Price Range Medium Solution
2147 Number of Ways to Divide a Long Corridor Hard Solution
2148 Count Elements With Strictly Smaller and Greater Elements Easy Solution
2149 Rearrange Array Elements by Sign Medium Solution
2150 Find All Lonely Numbers in the Array Medium Solution
2151 Maximum Good People Based on Statements Hard Solution
2154 Keep Multiplying Found Values by Two Easy Solution
2155 All Divisions With the Highest Score of a Binary Array Medium Solution
2156 Find Substring With Given Hash Value Hard Solution
2157 Groups of Strings Hard Solution
2160 Minimum Sum of Four Digit Number After Splitting Digits Easy Solution
2161 Partition Array According to Given Pivot Medium Solution
2162 Minimum Cost to Set Cooking Time Medium Solution
2163 Minimum Difference in Sums After Removal of Elements Hard Solution
2164 Sort Even and Odd Indices Independently Easy Solution
2165 Smallest Value of the Rearranged Number Medium Solution
2166 Design Bitset Medium Solution
2167 Minimum Time to Remove All Cars Containing Illegal Goods Hard Solution
2168 Unique Substrings With Equal Digit Frequency Medium Solution
2169 Count Operations to Obtain Zero Easy Solution
2170 Minimum Operations to Make the Array Alternating Medium Solution
2171 Removing Minimum Number of Magic Beans Medium Solution
2172 Maximum AND Sum of Array Hard Solution
2176 Count Equal and Divisible Pairs in an Array Easy Solution
2177 Find Three Consecutive Integers That Sum to a Given Number Medium Solution
2178 Maximum Split of Positive Even Integers Medium Solution
2179 Count Good Triplets in an Array Hard Solution
2180 Count Integers With Even Digit Sum Easy Solution
2181 Merge Nodes in Between Zeros Medium Solution
2182 Construct String With Repeat Limit Medium Solution
2183 Count Array Pairs Divisible by K Hard Solution
2185 Counting Words With a Given Prefix Easy Solution
2186 Minimum Number of Steps to Make Two Strings Anagram II Medium Solution
2187 Minimum Time to Complete Trips Medium Solution
2188 Minimum Time to Finish the Race Hard Solution
2189 Number of Ways to Build House of Cards Medium Solution
2190 Most Frequent Number Following Key In an Array Easy Solution
2191 Sort the Jumbled Numbers Medium Solution
2192 All Ancestors of a Node in a Directed Acyclic Graph Medium Solution
2193 Minimum Number of Moves to Make Palindrome Hard Solution
2194 Cells in a Range on an Excel Sheet Easy Solution
2195 Append K Integers With Minimal Sum Medium Solution
2196 Create Binary Tree From Descriptions Medium Solution
2197 Replace Non-Coprime Numbers in Array Hard Solution
2200 Find All K-Distant Indices in an Array Easy Solution
2201 Count Artifacts That Can Be Extracted Medium Solution
2202 Maximize the Topmost Element After K Moves Medium Solution
2203 Minimum Weighted Subgraph With the Required Paths Hard Solution
2206 Divide Array Into Equal Pairs Easy Solution
2207 Maximize Number of Subsequences in a String Medium Solution
2208 Minimum Operations to Halve Array Sum Medium Solution
2209 Minimum White Tiles After Covering With Carpets Hard Solution
2210 Count Hills and Valleys in an Array Easy Solution
2211 Count Collisions on a Road Medium Solution
2212 Maximum Points in an Archery Competition Medium Solution
2214 Minimum Health to Beat Game Medium Solution
2215 Find the Difference of Two Arrays Easy Solution
2216 Minimum Deletions to Make Array Beautiful Medium Solution
2217 Find Palindrome With Fixed Length Medium Solution
2218 Maximum Value of K Coins From Piles Hard Solution
2220 Minimum Bit Flips to Convert Number Easy Solution
2221 Find Triangular Sum of an Array Medium Solution
2222 Number of Ways to Select Buildings Medium Solution
2224 Minimum Number of Operations to Convert Time Easy Solution
2225 Find Players With Zero or One Losses Medium Solution
2226 Maximum Candies Allocated to K Children Medium Solution
2227 Encrypt and Decrypt Strings Hard Solution
2229 Check if an Array Is Consecutive Easy Solution
2231 Largest Number After Digit Swaps by Parity Easy Solution
2232 Minimize Result by Adding Parentheses to Expression Medium Solution
2233 Maximum Product After K Increments Medium Solution
2235 Add Two Integers Easy Solution
2236 Root Equals Sum of Children Easy Solution
2239 Find Closest Number to Zero Easy Solution
2240 Number of Ways to Buy Pens and Pencils Medium Solution
2241 Design an ATM Machine Medium Solution
2243 Calculate Digit Sum of a String Easy Solution
2244 Minimum Rounds to Complete All Tasks Medium Solution
2255 Count Prefixes of a Given String Easy Solution
2305 Fair Distribution of Cookies Medium Solution

FAQ

Space Complexity

I always only estimate the extra space excluding the space taken by the answer.

This is because the space for the answer is needed anyway for all algorithms of the same problem and it is the extra space that tells good algorithms apart from bad ones.

For example, assume a problem's answer always takes O(N^2) space. Algorithm A takes O(1) extra space, algorithm B takes O(N) extra space, and algorithm C takes O(N^2) extra space.

Which algorithm is better from space complexity perspective? Definitely algorithm A is the best, algorithm B is the second and algorithm C is the worst.

But if we take the answer space into account, all these three algorithms have the same O(N^2) space complexity overall.

So, only estimating the extra space excluding the answer space helps us better understand the algorithm's overhead.

License

All rights reserved by github.com/lzl124631x. Contact me if you want to redistribute the code. No commercial use.