Awesome Open Source
Awesome Open Source
Sponsorship

LeetCode License Build Status Language

If you like this project, please leave me a star. ★

"For coding interview preparation, LeetCode is one of the best online resource providing a rich library of more than 300 real coding interview questions for you to practice from using one of the 7 supported languages - C, C++, Java, Python, C#, JavaScript, Ruby."

Algorithms

# Title Solutions Video Difficulty Tag
1630 Arithmetic Subarrays Solution Medium Sort
1629 Slowest Key Solution Easy Array
1626 Best Team With No Conflicts Solution Medium DP
1625 Lexicographically Smallest String After Applying Operations Solution Medium BFS, DFS
1624 Largest Substring Between Two Equal Characters Solution Easy String
1620 Coordinate With Maximum Network Quality Solution Medium Greedy
1619 Mean of Array After Removing Some Elements Solution Easy Array
1614 Maximum Nesting Depth of the Parentheses Solution Easy String
1609 Even Odd Tree Solution Medium Tree
1608 Special Array With X Elements Greater Than or Equal X Solution Easy Array
1604 Alert Using Same Key-Card Three or More Times in a One Hour Period Solution Medium String, Ordered Map
1603 Design Parking System Solution Easy Design
1601 Maximum Number of Achievable Transfer Requests Solution Hard Backtracking
1598 Crawler Log Folder Solution Easy Stack
1592 Rearrange Spaces Between Words Solution Easy String
1588 Sum of All Odd Length Subarrays Solution Easy Array
1583 Count Unhappy Friends Solution Medium Array
1582 Special Positions in a Binary Matrix Solution Easy Array
1576 Replace All ?'s to Avoid Consecutive Repeating Characters Solution 📺 Easy String
1574 Shortest Subarray to be Removed to Make Array Sorted Solution Medium Array, Binary Search
1572 Matrix Diagonal Sum Solution Easy Array
1567 Maximum Length of Subarray With Positive Product Solution 📺 Medium Greedy
1566 Detect Pattern of Length M Repeated K or More Times Solution 📺 Easy Array
1561 Maximum Number of Coins You Can Get Solution 📺 Medium Sort
1560 Most Visited Sector in a Circular Track Solution Easy Array
1558 Minimum Numbers of Function Calls to Make Target Array Solution Medium Greedy
1557 Minimum Number of Vertices to Reach All Nodes Solution Medium Graph
1556 Thousand Separator Solution 📺 Easy String
1551 Minimum Operations to Make Array Equal Solution 📺 Medium Math
1550 Three Consecutive Odds Solution Easy Array
1545 Find Kth Bit in Nth Binary String Solution 📺 Medium String
1544 Make The String Great Solution 📺 Easy String, Stack
1541 Minimum Insertions to Balance a Parentheses String Solution 📺 Medium String, Stack
1539 Kth Missing Positive Number Solution 📺 Easy Array, HashTable
1535 Find the Winner of an Array Game Solution 📺 Medium Array
1534 Count Good Triplets Solution Easy Array
1528 Shuffle String Solution Easy Sort
1526 Minimum Number of Increments on Subarrays to Form a Target Array Solution Hard Segment Tree
1525 Number of Good Ways to Split a String Solution 📺 Medium String, Bit Manipulation
1524 Number of Sub-arrays With Odd Sum Solution Medium Array, Math
1523 Count Odd Numbers in an Interval Range Solution 📺 Easy Math
1518 Water Bottles Solution Easy Greedy
1514 Path with Maximum Probability Solution Medium Graph
1512 Number of Good Pairs Solution Easy Array, HashTable, Math
1508 Range Sum of Sorted Subarray Sums Solution Medium Array, Sort
1507 Reformat Date Solution Easy String
1502 Can Make Arithmetic Progression From Sequence Solution Easy Array, Sort
1496 Path Crossing Solution Easy String
1493 Longest Subarray of 1's After Deleting One Element Solution Medium Array
1492 The kth Factor of n Solution Medium Math
1491 Average Salary Excluding the Minimum and Maximum Salary Solution Easy Array, Sort
1487 Making File Names Unique Solution Medium HashTable, String
1486 XOR Operation in an Array Solution Medium Array, Bit Manipulation
1481 Least Number of Unique Integers after K Removals Solution Medium Array, Sort
1480 Running Sum of 1d Array Solution, C++ Easy Array
1476 Subrectangle Queries Solution Medium Array
1475 Final Prices With a Special Discount in a Shop Solution Easy Array
1471 The k Strongest Values in an Array Solution Medium Array, Sort
1470 Shuffle the Array Solution, C++ Easy Array
1469 Find All The Lonely Nodes Solution Easy Tree, DFS
1466 Reorder Routes to Make All Paths Lead to the City Zero Solution Medium Tree, DFS
1464 Maximum Product of Two Elements in an Array Solution Easy Array
1460 Make Two Arrays Equal by Reversing Sub-arrays Solution Easy Array
1457 Pseudo-Palindromic Paths in a Binary Tree Solution Medium Bit Manipulation, Tree, DFS
1456 Maximum Number of Vowels in a Substring of Given Length Solution Medium String, Sliding Window
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence Solution Easy String
1452 People Whose List of Favorite Companies Is Not a Subset of Another List Solution Medium String, Sort
1451 Rearrange Words in a Sentence Solution Medium String, Sort
1450 Number of Students Doing Homework at a Given Time Solution Easy Array
1448 Count Good Nodes in Binary Tree Solution Medium Tree, DFS
1447 Simplified Fractions Solution Medium Math
1446 Consecutive Characters Solution Easy String
1441 Build an Array With Stack Operations Solution Easy Stack
1437 Check If All 1's Are at Least Length K Places Away Solution Medium Array
1436 Destination City Solution Easy String
1432 Max Difference You Can Get From Changing an Integer Solution Medium String
1431 Kids With the Greatest Number of Candies Solution, C++ Easy Array
1428 Leftmost Column with at Least a One Solution Medium Array
1427 Perform String Shifts Solution Easy Array, Math
1426 Counting Elements Solution Easy Array
1423 Maximum Points You Can Obtain from Cards Solution Medium Array, DP, Sliding Window
1422 Maximum Score After Splitting a String Solution Easy String
1418 Display Table of Food Orders in a Restaurant Solution Medium HashTable
1417 Reformat The String Solution Easy String
1415 The k-th Lexicographical String of All Happy Strings of Length n Solution Medium Backtracking
1413 Minimum Value to Get Positive Step by Step Sum Solution Easy Array
1410 HTML Entity Parser Solution Medium String, Stack
1409 Queries on a Permutation With Key Solution Medium Array
1408 String Matching in an Array Solution Easy String
1403 Minimum Subsequence in Non-Increasing Order Solution Easy Greedy, Sort
1402 Reducing Dishes Solution Hard Dynamic Programming
1401 Circle and Rectangle Overlapping Solution Medium Geometry
1400 Construct K Palindrome Strings Solution Medium Greedy
1399 Count Largest Group Solution Easy Array
1396 Design Underground System Solution Medium Design
1395 Count Number of Teams Solution Medium Array
1394 Find Lucky Integer in an Array Solution Easy Array
1392 Longest Happy Prefix Solution Hard String, Rolling Hash
1390 Four Divisors Solution Medium Math
1389 Create Target Array in the Given Order Solution Easy Array
1388 Pizza With 3n Slices Solution Hard DP
1387 Sort Integers by The Power Value Solution Medium Sort, Graph
1386 Cinema Seat Allocation Solution Medium Array, Greedy
1385 Find the Distance Value Between Two Arrays Solution Easy Array
1382 Balance a Binary Search Tree Solution Medium Binary Search Tree
1381 Design a Stack With Increment Operation Solution Medium Stack, Design
1380 Lucky Numbers in a Matrix Solution Easy Array
1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Solution Medium Tree
1377 Frog Position After T Seconds Solution Hard DFS, BFS
1376 Time Needed to Inform All Employees Solution Medium DFS
1375 Bulb Switcher III Solution Medium Array
1374 Generate a String With Characters That Have Odd Counts Solution Easy String
1373 Maximum Sum BST in Binary Tree Solution Hard DP, BST
1372 Longest ZigZag Path in a Binary Tree Solution Hard DP, Tree
1371 Find the Longest Substring Containing Vowels in Even Counts Solution Medium String
1370 Increasing Decreasing String Solution Easy String, Sort
1367 Linked List in Binary Tree Solution Medium DP, Linked List, Tree
1366 Rank Teams by Votes Solution Medium Array, Sort
1365 How Many Numbers Are Smaller Than the Current Number Solution Easy Array, HashTable
1362 Closest Divisors Solution Medium Math
1361 Validate Binary Tree Nodes Solution Medium Graph
1360 Number of Days Between Two Dates Solution Easy
1358 Number of Substrings Containing All Three Characters Solution Medium String
1357 Apply Discount Every n Orders Solution Medium Design
1356 Sort Integers by The Number of 1 Bits Solution Easy Sort, Bit Manipulation
1354 Construct Target Array With Multiple Sums Solution Hard Greedy
1353 Maximum Number of Events That Can Be Attended Solution Medium Greedy, Sort, Segment Tree
1352 Product of the Last K Numbers Solution Medium Array, Design
1351 Count Negative Numbers in a Sorted Matrix Solution Easy Array, Binary Search
1349 Maximum Students Taking Exam Solution Hard Dynamic Programming
1348 Tweet Counts Per Frequency Solution Medium Design
1347 Minimum Number of Steps to Make Two Strings Anagram Solution Easy String
1346 Check If N and Its Double Exist Solution Easy Array
1345 Jump Game IV Solution Hard BFS
1344 Angle Between Hands of a Clock Solution Medium Math
1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Solution Medium Array
1342 Number of Steps to Reduce a Number to Zero Solution Easy Bit Manipulation
1341 The K Weakest Rows in a Matrix Solution Easy
1339 Maximum Product of Splitted Binary Tree Solution Medium DP, Tree
1338 Reduce Array Size to The Half Solution Medium
1337 Remove Palindromic Subsequences Solution Easy String
1333 Filter Restaurants by Vegan-Friendly, Price and Distance Solution Medium
1331 Rank Transform of an Array Solution Easy
1329 Sort the Matrix Diagonally Solution Medium
1325 Delete Leaves With a Given Value Solution Medium Tree
1324 Print Words Vertically Solution Medium String
1323 Maximum 69 Number Solution Easy Math
1317 Convert Integer to the Sum of Two No-Zero Integers Solution Easy
1315 Sum of Nodes with Even-Valued Grandparent Solution Medium Tree, DFS
1314 Matrix Block Sum Solution Medium Dynamic Programming
1313 Decompress Run-Length Encoded List Solution Easy Array
1305 All Elements in Two Binary Search Trees Solution Medium
1304 Find N Unique Integers Sum up to Zero Solution Easy
1302 Deepest Leaves Sum Solution Medium
1300 Sum of Mutated Array Closest to Target Solution Medium
1299 Replace Elements with Greatest Element on Right Side Solution Easy
1297 Maximum Number of Occurrences of a Substring Solution Medium
1296 Divide Array in Sets of K Consecutive Numbers Solution Medium
1295 Find Numbers with Even Number of Digits Java Javascript 📺 Easy
1291 Sequential Digits Solution Medium
1290 Convert Binary Number in a Linked List to Integer Solution Easy
1289 Minimum Falling Path Sum II Solution Hard Dynamic Programming
1287 Element Appearing More Than 25% In Sorted Array Solution 📺 Easy
1286 Iterator for Combination Solution Medium Backtracking, Design
1282 Group the People Given the Group Size They Belong To Solution 📺 Medium
1281 Subtract the Product and Sum of Digits of an Integer Solution Easy
1277 Count Square Submatrices with All Ones Solution Medium
1275 Find Winner on a Tic Tac Toe Game Solution Easy Array
1273 Delete Tree Nodes Solution Medium Dynamic Programming, DFS
1271 Hexspeak Solution Easy
1267 Count Servers that Communicate Solution Medium
1266 Minimum Time Visiting All Points Solution Easy
1265 Print Immutable Linked List in Reverse Solution Medium
1261 Find Elements in a Contaminated Binary Tree Solution Medium Tree, HashTable
1260 Shift 2D Grid Solution 📺 Easy
1258 Synonymous Sentences Solution Medium Backtracking
1252 Cells with Odd Values in a Matrix Solution Easy
1237 Find Positive Integer Solution for a Given Equation Solution Easy
1243 Array Transformation Solution 📺 Easy
1232 Check If It Is a Straight Line Solution 📺 Easy
1228 Missing Number In Arithmetic Progression Solution Easy
1221 Split a String in Balanced Strings Solution Easy Greedy
1219 Path with Maximum Gold Solution Medium Backtracking
1217 Play with Chips Solution Easy Array, Math, Greedy
1214 Two Sum BSTs Solution Medium Binary Search Tree
1213 Intersection of Three Sorted Arrays Solution 📺 Easy
1209 Remove All Adjacent Duplicates in String II Solution Medium Stack
1207 Unique Number of Occurrences Solution 📺 Easy
1200 Minimum Absolute Difference Solution 📺 Easy
1198 Find Smallest Common Element in All Rows Solution 📺 Easy
1196 How Many Apples Can You Put into the Basket Solution 📺 Easy
1190 Reverse Substrings Between Each Pair of Parentheses Solution Medium Stack
1189 Maximum Number of Balloons Solution 📺 Easy
1185 Day of the Week Solution Easy
1184 Distance Between Bus Stops Solution 📺 Easy
1182 Shortest Distance to Target Color Solution Medium Binary Search
1180 Count Substrings with Only One Distinct Letter Solution Easy Math, String
1176 Diet Plan Performance Solution Easy Array, Sliding Window
1175 Prime Arrangements Solution Easy
1165 Single-Row Keyboard Solution Easy
1161 Maximum Level Sum of a Binary Tree Solution Medium Graph
1160 Find Words That Can Be Formed by Characters Solution Easy
1154 Day of the Year Solution Easy
1150 Check If a Number Is Majority Element in a Sorted Array Solution 📺 Easy
1137 N-th Tribonacci Number Solution Easy
1134 Armstrong Number Solution 📺 Easy
1133 Largest Unique Number Solution 📺 Easy
1128 Number of Equivalent Domino Pairs Solution 📺 Easy
1122 Relative Sort Array Solution Easy
1170 Compare Strings by Frequency of the Smallest Character Solution Easy
1119 Remove Vowels from a String Solution 📺 Easy
1118 Number of Days in a Month Solution Easy
1114 Print in Order Solution Easy
1108 Defanging an IP Address Solution 📺 Easy
1104 Path In Zigzag Labelled Binary Tree Solution Medium Math, Tree
1103 Distribute Candies to People Solution Easy Math
1100 Find K-Length Substrings With No Repeated Characters Solution Medium String, Sliding Window
1099 Two Sum Less Than K Solution 📺 Easy
1089 Duplicate Zeros Solution Easy
1087 Brace Expansion Solution Medium Backtracking
1086 High Five Solution 📺 Easy
1085 Sum of Digits in the Minimum Number Solution 📺 Easy
1079 Letter Tile Possibilities Solution Medium
1078 Occurrences After Bigram Solution Easy
1071 Greatest Common Divisor of Strings Solution Easy
1066 Campus Bikes II Solution Medium Backtracking, DP
1065 Index Pairs of a String Solution Medium
1062 Longest Repeating Substring Solution Medium
1057 Campus Bikes Solution Medium
1056 Confusing Number Solution Easy
1055 Fixed Point Solution Easy
1051 Height Checker Solution Easy
1047 Remove All Adjacent Duplicates In String Solution Easy
1046 Last Stone Weight Solution 📺 Easy
1043 Partition Array for Maximum Sum Solution Medium DP
1038 Binary Search Tree to Greater Sum Tree Solution Medium DFS, tree
1037 Valid Boomerang Solution Easy Math
1033 Moving Stones Until Consecutive Solution Easy Math
1030 Matrix Cells in Distance Order Solution Easy
1029 Two City Scheduling Solution Easy
1025 Divisor Game Solution Easy
1022 Sum of Root To Leaf Binary Numbers Solution Easy
1021 Remove Outermost Parentheses Solution Easy
1020 Number of Enclaves Solution Medium Graph, DFS, BFS, recursion
1019 Next Greater Node In Linked List Solution Medium Linked List, Stack
1018 Binary Prefix Divisible By 5 Solution Easy
1014 Best Sightseeing Pair Solution Medium
1013 Partition Array Into Three Parts With Equal Sum Solution Easy
1011 Capacity To Ship Packages Within D Days Solution Medium Binary Search
1010 Pairs of Songs With Total Durations Divisible by 60 Solution Easy
1009 Complement of Base 10 Integer Solution Easy
1008 Construct Binary Search Tree from Preorder Traversal Solution Medium Recursion
1005 Maximize Sum Of Array After K Negations Solution 📺 Easy
1004 Max Consecutive Ones III Solution Medium Two Pointers, Sliding Window
1003 Check If Word Is Valid After Substitutions Solution Medium
1002 Find Common Characters Solution Easy
999 Available Captures for Rook Solution Easy
997 Find the Town Judge Solution Easy
994 Rotting Oranges Solution Easy BFS
993 Cousins in Binary Tree Solution Easy Tree, BFS
989 Add to Array-Form of Integer Solution Easy Array
988 Smallest String Starting From Leaf Solution Medium Tree, DFS
987 Vertical Order Traversal of a Binary Tree Solution Medium Recursion
986 Interval List Intersections Solution Medium Two Pointers
985 Sum of Even Numbers After Queries Solution Easy Array
980 Unique Paths III Solution Hard Backtracking, DFS
979 Distribute Coins in Binary Tree Solution Medium Recursion
977 Squares of a Sorted Array Solution Easy Array
976 Largest Perimeter Triangle Solution Easy Math Array
974 Subarray Sums Divisible by K Solution Medium Array
973 K Closest Points to Origin Solution Easy Math Sort
970 Powerful Integers Solution Easy Math
966 Vowel Spellchecker Solution Medium Hash Table, String
965 Univalued Binary Tree Solution Easy DFS, recursion
961 N-Repeated Element in Size 2N Array Solution Easy
958 Check Completeness of a Binary Tree Solution Medium Tree
957 Prison Cells After N Days Solution Medium
954 Array of Doubled Pairs Solution 📺 Medium
953 Verifying an Alien Dictionary Solution Easy
951 Flip Equivalent Binary Trees Solution Medium Tree, DFS, recursion
950 Reveal Cards In Increasing Order Solution Medium
946 Validate Stack Sequences Solution Medium Stack
944 Delete Columns to Make Sorted Solution Easy
942 DI String Match Solution Easy
941 Valid Mountain Array Solution Easy
938 Range Sum of BST Solution Medium BST, recursion, DFS
937 Reorder Log Files Solution Easy
935 Knight Dialer Solution Medium
933 Number of Recent Calls Solution Easy
931 Minimum Falling Path Sum Solution Medium Dynamic Programming
929 Unique Email Addresses Solution Easy
925 Long Pressed Name Solution Easy
922 Sort Array By Parity II Solution Easy
921 Minimum Add to Make Parentheses Valid Solution Medium Stack, Greedy
917 Reverse Only Letters Solution Easy
914 X of a Kind in a Deck of Cards Solution Easy
912 Sort an Array Solution Easy
908 Smallest Range I Solution Easy
901 Online Stock Span Solution Medium Stack
900 RLE Iterator Solution Medium
897 Increasing Order Search Tree Solution Easy DFS, recursion
896 Monotonic Array Solution Easy
890 Find and Replace Pattern Solution Medium
893 Groups of Special-Equivalent Strings Solution 📺 Easy
888 Fair Candy Swap Solution Easy
885 Spiral Matrix III Solution 📺 Medium
884 Uncommon Words from Two Sentences Solution Easy
883 Projection Area of 3D Shapes Solution Easy Math
880 Decoded String at Index Solution Medium Stack
876 Middle of the Linked List Solution Easy
872 Leaf-Similar Trees Solution Easy DFS, recursion
868 Binary Gap Solution Easy
867 Transpose Matrix Solution Easy
860 Lemonade Change Solution Easy
859 Buddy Strings Solution Easy
856 Score of Parentheses Solution Medium Stack, String
852 Peak Index in a Mountain Array Solution Easy
849 Maximize Distance to Closest Person Solution Easy
844 Backspace String Compare Solution Easy
841 Keys and Rooms Solution Easy DFS, Graph
840 Magic Squares In Grid Solution Easy
836 Rectangle Overlap Solution 📺 Easy
832 Flipping an Image Solution Easy
830 Positions of Large Groups Solution Easy
824 Goat Latin Solution Easy
821 Shortest Distance to a Character Solution Easy
819 Most Common Word Solution Easy HashMap
814 Binary Tree Pruning Solution Medium recursion, DFS
811 Subdomain Visit Count Solution Easy HashMap
807 Max Increase to Keep City Skyline Solution Medium
806 Number of Lines To Write String Solution Easy
804 Unique Morse Code Words Solution Easy
800 Similar RGB Color Solution Easy
799 Champagne Tower Solution Medium
796 Rotate String Solution Easy
791 Custom Sort String Solution Medium
789 Escape The Ghosts Solution Medium Math
788 Rotated Digits Solution Easy
784 Letter Case Permutation Solution Easy
783 Minimum Distance Between BST Nodes Solution Easy
779 K-th Symbol in Grammar Solution Medium
776 Split BST Solution Medium Recursion
771 Jewels and Stones Solution Easy
769 Max Chunks To Make Sorted Solution Medium Array
767 Reorganize String Solution Medium
766 Toeplitz Matrix Solution Easy
765 Couples Holding Hands Solution Hard
764 Largest Plus Sign Solution Medium DP
763 Partition Labels Solution Medium
762 Prime Number of Set Bits in Binary Representation Solution Easy
760 Find Anagram Mappings Solution Easy
758 Bold Words in String Solution Easy
756 Pyramid Transition Matrix Solution Medium Backtracking
755 Pour Water Solution Medium Array
754 Reach a Number Solution Medium Math
750 Number Of Corner Rectangles Solution Medium
748 Shortest Completing Word Solution Easy
747 Largest Number Greater Than Twice of Others Solution Easy
746 Min Cost Climbing Stairs Solution Easy
744 Find Smallest Letter Greater Than Target Solution Easy
743 Network Delay Time Solution Medium Graph, Djikstra
742 Closest Leaf in a Binary Tree Solution Medium Tree
740 Delete and Earn Solution Medium
739 Daily Temperatures Solution Medium
738 Monotone Increasing Digits Solution Medium
737 Sentence Similarity II Solution Medium Union Find
735 Asteroid Collision Solution Medium Stack
734 Sentence Similarity Solution Easy HashTable
733 Flood Fill Solution Easy BFS, DFS
729 My Calendar I Solution Medium
728 Self Dividing Numbers Solution Easy
727 Minimum Window Subsequence Solution Hard DP
725 Split Linked List in Parts Solution Medium LinkedList
724 Find Pivot Index Solution Easy Array
723 Candy Crush Solution Medium Array, Two Pointers
721 Accounts Merge Solution Medium DFS, Union Find
720 Longest Word in Dictionary Solution Easy Trie
719 Find K-th Smallest Pair Distance Solution Hard Binary Search
718 Maximum Length of Repeated Subarray Solution Medium DP
717 1-bit and 2-bit Characters Solution Easy
716 Max Stack Solution Hard Design
714 Best Time to Buy and Sell Stock with Transaction Fee Solution Medium DP
713 Subarray Product Less Than K Solution Medium
712 Minimum ASCII Delete Sum for Two Strings Solution Medium DP
709 To Lower Case Solution Easy String
706 Design HashMap Solution Easy Design
705 Design HashSet Solution Easy Design
704 Binary Search Solution Easy Binary Search
703 Kth Largest Element in a Stream Solution Easy
701 Insert into a Binary Search Tree Solution Medium DFS, recursion
700 Search in a Binary Search Tree Solution Easy recusion, dfs
699 Falling Squares Solution Hard Segment Tree
698 Partition to K Equal Sum Subsets Solution, C++ Medium Backtracking + DP
697 Degree of an Array Solution Easy
696 Count Binary Substrings Solution Easy
695 Max Area of Island Solution Easy DFS
694 Number of Distinct Islands Solution Medium DFS
693 Binary Number with Alternating Bits Solution Easy
692 Top K Frequent Words Solution Medium
691 Stickers to Spell Word Solution Hard DP
690 Employee Importance Solution Easy DFS
689 Maximum Sum of 3 Non-Overlapping Subarrays Solution Hard DP
688 Knight Probability in Chessboard Solution Medium DP
687 Longest Univalue Path Solution Easy DFS
686 Repeated String Match Solution Easy
685 Redundant Connection II Solution Hard Union Find
684 Redundant Connection Solution Medium Union Find
683 K Empty Slots Solution Hard
682 Baseball Game Solution Easy
681 Next Closest Time Solution Medium
680 Valid Palindrome II Solution Easy String
679 24 Game Solution Hard Recursion
678 Valid Parenthesis String Solution Medium Recursion, Greedy
677 Map Sum Pairs Solution Medium HashMap, Trie
676 Implement Magic Dictionary Solution Medium
675 Cut Off Trees for Golf Event Solution Hard BFS
674 Longest Continuous Increasing Subsequence Solution Easy
673 Number of Longest Increasing Subsequence Solution Medium DP
672 Bulb Switcher II Solution Medium Math
671 Second Minimum Node In a Binary Tree Solution Easy Tree, DFS
670 Maximum Swap Solution Medium String
669 Trim a Binary Search Tree Solution Easy Tree, DFS
668 Kth Smallest Number in Multiplication Table Solution Hard Binary Search
667 Beautiful Arrangement II Solution Medium Array
666 Path Sum IV Solution Medium Tree, DFS
665 Non-decreasing Array Solution Easy
664 Strange Printer Solution Hard DP
663 Equal Tree Partition Solution Medium Tree
662 Maximum Width of Binary Tree Solution Medium BFS, DFS
661 Image Smoother Solution Easy Array
660 Remove 9 Solution Hard Math
659 Split Array into Consecutive Subsequences Solution Medium HashMap
658 Find K Closest Elements Solution Medium
657 Judge Route Circle Solution Easy
656 Coin Path Solution Hard DP
655 Print Binary Tree Solution Medium Recursion
654 Maximum Binary Tree Solution Medium Tree
653 Two Sum IV - Input is a BST Solution Easy Tree
652 Find Duplicate Subtrees Solution Medium Tree
651 4 Keys Keyboard Solution Medium DP
650 2 Keys Keyboard Solution Medium DP
649 Dota2 Senate Solution Medium Greedy
648 Replace Words Solution Medium Trie
647 Palindromic Substrings Solution Medium DP
646 Maximum Length of Pair Chain Solution Medium DP, Greedy
645 Set Mismatch Solution Easy
644 Maximum Average Subarray II Solution Hard Binary Search
643 Maximum Average Subarray I Solution Easy
642 Design Search Autocomplete System Solution Hard Design
640 Solve the Equation Solution Medium
639 Decode Ways II Solution Hard DP
638 Shopping Offers Solution Medium DP, DFS
637 Average of Levels in Binary Tree Solution Easy
636 Exclusive Time of Functions Solution Medium Stack
635 Design Log Storage System Solution Medium Design
634 Find the Derangement of An Array Solution Medium Math
633 Sum of Square Numbers Solution Easy Binary Search
632 Smallest Range Solution Hard Heap
631 Design Excel Sum Formula Solution Hard Design, Topological Sort
630 Course Schedule III Solution Hard Heap, Greedy
629 K Inverse Pairs Array Solution Hard DP
628 Maximum Product of Three Numbers Solution Easy
625 Minimum Factorization Solution Medium
624 Maximum Distance in Arrays Solution Easy Sort, Array
623 Add One Row to Tree Solution Medium Tree
621 Task Scheduler Solution Medium Greedy, Queue
617 Merge Two Binary Trees Solution Easy Tree, Recursion
616 Add Bold Tag in String Solution Medium String
611 Valid Triangle Number Solution Medium Binary Search
609 Find Duplicate File in System Solution Medium HashMap
606 Construct String from Binary Tree Solution Easy Tree, Recursion
605 Can Place Flowers Solution Easy Array
604 Design Compressed String Iterator Solution Easy Design, String
600 Non-negative Integers without Consecutive Ones Solution Hard Bit Manipulation, DP
599 Minimum Index Sum of Two Lists Solution Easy HashMap
598 Range Addition II Solution Easy
594 Longest Harmonious Subsequence Solution Easy Array, HashMap
593 Valid Square Solution Medium Math
592 Fraction Addition and Subtraction Solution Medium Math
591 Tag Validator Solution Hard Stack, String
590 N-ary Tree Postorder Traversal Solution Easy DFS, recursion
589 N-ary Tree Preorder Traversal Solution Easy DFS, recursion
588 Design In-Memory File System Solution Hard Trie, Design
587 Erect the Fence Solution Hard Geometry
583 Delete Operation for Two Strings Solution Medium DP
582 Kill Process Solution Medium Stack
581 Shortest Unsorted Continuous Subarray Solution Easy Array, Sort
576 Out of Boundary Paths Solution Hard DP, DFS
575 Distribute Candies Solution Easy Array
573 Squirrel Simulation Solution Medium Math
572 Subtree of Another Tree Solution Easy Tree
568 Maximum Vacation Days Solution Hard DP
567 Permutation in String Solution Medium Sliding Windows, Two Pointers
566 Reshape the Matrix Solution Easy
565 Array Nesting Solution Medium
563 Binary Tree Tilt Solution Easy Tree Recursion
562 Longest Line of Consecutive One in Matrix Solution Medium Matrix DP
561 Array Partition I Solution Easy Array
560 Subarray Sum Equals K Solution Medium Array, HashMap
559 Maximum Depth of N-ary Tree Solution Easy DFS, recursion
557 Reverse Words in a String III Solution Easy String
556 Next Greater Element III Solution Medium String
555 Split Concatenated Strings Solution Medium String
554 Brick Wall Solution Medium HashMap
553 Optimal Division Solution Medium String, Math
552 Student Attendance Record II Solution Hard DP
551 Student Attendance Record I Solution Easy String
549 Binary Tree Longest Consecutive Sequence II Solution Medium Tree
548 Split Array with Equal Sum Solution Medium Array
547 Friend Circles Solution Medium Union Find
546 Remove Boxes Solution Hard DFS, DP
545 Boundary of Binary Tree Solution Medium Recursion
544 Output Contest Matches Solution Medium Recursion
543 Diameter of Binary Tree Solution Easy Tree/DFS/Recursion
542 01 Matrix Solution Medium BFS
541 Reverse String II Solution Easy String
540 Single Element in a Sorted Array Solution Medium
539 Minimum Time Difference Solution Medium String
538 Convert BST to Greater Tree Solution Easy Tree
537 Complex Number Multiplication Solution Medium Math, String
536 Construct Binary Tree from String Solution Medium Recursion, Stack
535 Encode and Decode TinyURL Solution Medium Design
533 Lonely Pixel II Solution Medium HashMap
532 K-diff Pairs in an Array Solution Easy HashMap
531 Lonely Pixel I Solution Medium
530 Minimum Absolute Difference in BST Solution Easy DFS
529 Minesweeper Solution Medium BFS
527 Word Abbreviation Solution Hard
526 Beautiful Arrangement Solution Medium Backtracking
525 Contiguous Array Solution Medium HashMap
524 Longest Word in Dictionary through Deleting Solution Medium Sort
523 Continuous Subarray Sum Solution Medium DP
522 Longest Uncommon Subsequence II Solution Medium
521 Longest Uncommon Subsequence I Solution Easy
520 Detect Capital Solution Easy
517 Super Washing Machines Solution Hard DP
516 Longest Palindromic Subsequence Solution Medium DP
515 Find Largest Value in Each Tree Row Solution Medium BFS
514 Freedom Trail Solution Hard DP
513 Find Bottom Left Tree Value Solution Medium BFS
509 Fibonacci Number Solution 📺 Easy Array
508 Most Frequent Subtree Sum Solution Medium DFS, Tree
507 Perfect Number Solution Easy Math
506 Relative Ranks Solution Easy
505 The Maze II Solution Medium BFS
504 Base 7 Solution Easy
503 Next Greater Element II Solution Medium Stack
502 IPO Solution Hard Heap, Greedy
501 Find Mode in Binary Tree Solution Easy Binary Tree
500 Keyboard Row Solution Easy
499 The Maze III Solution Hard BFS
496 Next Greater Element I Solution Easy
498 Diagonal Traverse Solution Medium
495 Teemo Attacking Solution Medium Array
494 Target Sum Solution Medium
493 Reverse Pairs Solution Hard Recursion
492 Construct the Rectangle Solution Easy Array
491 Increasing Subsequences Solution Medium Backtracking, DFS
490 The Maze Solution Medium BFS
488 Zuma Game Solution Hard DFS, Backtracking
487 Max Consecutive Ones II Solution Medium Array
486 Predict the Winner Solution Medium DP
485 Max Consecutive Ones Java Javascript Easy Array
484 Find Permutation Solution Medium Array, String, Greedy
483 Smallest Good Base Solution Hard Binary Search, Math
482 License Key Formatting Solution Medium
481 Magical String Solution Medium
480 Sliding Window Median Solution Hard Heap
479 Largest Palindrome Product Solution Easy
477 Total Hamming Distance Solution Medium Bit Manipulation
476 Number Complement Solution Easy Bit Manipulation
475 Heaters Solution Easy Array Binary Search
474 Ones and Zeroes Solution Medium DP
473 Matchsticks to Square Solution Medium Backtracking, DFS
472 Concatenated Words Solution Hard Trie, DP, DFS
471 Encode String with Shortest Length Solution Hard DP
469 Convex Polygon Solution Medium Math
468 Validate IP Address Solution Medium String
467 Unique Substrings in Wraparound String Solution Medium DP
466 Count The Repetitions Solution Hard DP
465 Optimal Account Balancing Solution Hard DP
464 Can I Win Solution Medium DP
463 Island Perimeter Solution Easy
462 Minimum Moves to Equal Array Elements II Solution Medium
461 Hamming Distance Solution, C++ Easy
460 LFU Cache Solution Hard Design, LinkedHashMap, HashMap
459 Repeated Substring Pattern Solution Easy String, KMP
458 Poor Pigs Solution Easy Math
457 Circular Array Loop Solution Medium
456 132 Pattern Solution Medium Stack
455 Assign Cookies Solution Easy
454 4Sum II Solution Medium HashMap
453 Minimum Moves to Equal Array Elements Solution Easy
452 Minimum Number of Arrows to Burst Balloons Solution Medium Array, Greedy
451 Sort Characters By Frequency Solution Medium HashMap
450 Delete Node in a BST Solution Medium Tree, Recursion
449 Serialize and Deserialize BST Solution Medium BFS
448 Find All Numbers Disappeared in an Array Solution Easy Array, HashMap
447 Number of Boomerangs Solution Easy HashMap
446 Arithmetic Slices II - Subsequence Solution Hard DP
445 Add Two Numbers II Solution Medium Stack, LinkedList
444 Sequence Reconstruction Solution Medium Topological Sort, Graph
443 String Compression Solution Easy
442 Find All Duplicates in an Array Solution Medium Array
441 Arranging Coins Solution Easy
440 K-th Smallest in Lexicographical Order Solution Hard
439 Ternary Expression Parser Solution Medium Stack
438 Find All Anagrams in a String Solution Easy Sliding Window
437 Path Sum III Solution Easy DFS, recursion
436 Find Right Interval Solution Medium Binary Search
435 Non-overlapping Intervals Solution Medium Greedy
434 Number of Segments in a String Solution Easy
432 All O`one Data Structure Solution Hard Design
429 N-ary Tree Level Order Traversal Solution Easy BFS, Tree
425 Word Squares Solution Hard Trie, Backtracking, Recursion
424 Longest Repeating Character Replacement Solution Medium Sliding Window
423 Reconstruct Original Digits from English Solution Medium Math
422 Valid Word Square Solution Easy
421 Maximum XOR of Two Numbers in an Array Solution Medium Bit Manipulation, Trie
420 Strong Password Checker Solution Hard
419 Battleships in a Board Solution Medium DFS
418 Sentence Screen Fitting Solution Medium
417 Pacific Atlantic Water Flow Solution Medium DFS
416 Partition Equal Subset Sum Java, C++ Medium DP
415 Add Strings Solution Easy
414 Third Maximum Number Solution Easy
413 Arithmetic Slices Solution Medium DP
412 Fizz Buzz Solution Easy
411 Minimum Unique Word Abbreviation Solution Hard NP-Hard, Backtracking, Trie, Recursion
410 Split Array Largest Sum Solution Hard Binary Search, DP
409 Longest Palindrome Solution Easy
408 Valid Word Abbreviation Solution Easy
407 Trapping Rain Water II Solution Hard Heap
406 Queue Reconstruction by Height Solution Medium LinkedList, PriorityQueue
405 Convert a Number to Hexadecimal Solution Easy
404 Sum of Left Leaves Solution Easy
403 Frog Jump Solution Hard DP
402 Remove K Digits Solution Medium Greedy, Stack
401 Binary Watch Solution Easy
400 Nth Digit Solution Easy
399 Evaluate Division Solution Medium Graph, DFS, Backtracking
398 Random Pick Index Solution Medium Reservoir Sampling
397 Integer Replacement Solution Easy BFS
396 Rotate Function Solution Easy
395 Longest Substring with At Least K Repeating Characters Solution Medium Recursion
394 Decode String Solution Medium Stack Depth-first-search
393 UTF-8 Validation Solution Medium Bit Manipulation
392 Is Subsequence Solution Medium Array, String
391 Perfect Rectangle Solution Hard
390 Elimination Game Solution Medium
389 Find the Difference Solution Easy
388 Longest Absolute File Path Solution Medium Stack
387 First Unique Character in a String Solution Easy HashMap
386 Lexicographical Numbers Solution Medium
385 Mini Parser Solution Medium Stack
384 Shuffle an Array Solution Medium
383 Ransom Note Solution Easy String
382 Linked List Random Node Solution Medium Reservoir Sampling
381 Insert Delete GetRandom O(1) - Duplicates allowed Solution Hard
380 Insert Delete GetRandom O(1) Solution Medium Design, HashMap
379 Design Phone Directory Solution Medium
378 Kth Smallest Element in a Sorted Matrix Solution Medium Binary Search
377 Combination Sum IV Solution Medium DP
376 Wiggle Subsequence Solution Medium DP, Greedy
375 Guess Number Higher or Lower II Solution Medium DP
374 Guess Number Higher or Lower Solution Easy Binary Search
373 Find K Pairs with Smallest Sums Solution Medium Heap
372 Super Pow Solution Medium Math
371 Sum of Two Integers Solution Easy
370 Range Addition Solution Medium Array
369 Plus One Linked List Solution Medium Linked List
368 Largest Divisible Subset Solution Medium DP
367 Valid Perfect Square Solution Medium
366 Find Leaves of Binary Tree Solution Medium DFS
365 Water and Jug Problem Solution Medium Math
364 Nested List Weight Sum II Solution Medium DFS
363 Max Sum of Rectangle No Larger Than K Solution Hard DP
362 Design Hit Counter Solution Medium Design
361 Bomb Enemy Solution Medium
360 Sort Transformed Array Solution Medium Two Pointers, Math
359 Logger Rate Limiter Solution Easy HashMap
358 Rearrange String k Distance Apart Solution Hard HashMap, Heap, Greedy
357 Count Numbers with Unique Digits Solution Medium DP, Math
356 Line Reflection Solution Medium HashSet
355 Design Twitter Solution Medium Design, HashMap, Heap
354 Russian Doll Envelopes Solution Hard DP, Binary Search
353 Design Snake Game Solution Medium
352 Data Stream as Disjoint Intervals Solution Hard TreeMap
351 Android Unlock Patterns Solution Medium
350 Intersection of Two Arrays II Solution 📺 Easy HashMap, Binary Search
349 Intersection of Two Arrays Solution 📺 Easy Two Pointers, Binary Search
348 Design Tic-Tac-Toe Solution Medium Design
347 Top K Frequent Elements Solution Medium HashTable, Heap, Bucket Sort
346 Moving Average from Data Stream Solution Easy Queue
345 Reverse Vowels of a String Solution Easy String
344 Reverse String Solution 📺 Easy String
343 Integer Break Solution Medium Math
342 Power of Four Solution Easy Math
341 Flatten Nested List Iterator Solution Medium Stack
340 Longest Substring with At Most K Distinct Characters Solution Hard Sliding Window
339 Nested List Weight Sum Solution Easy DFS
338 Counting Bits Solution Medium
337 House Robber III Solution Medium DP
336 Palindrome Pairs Solution Hard
335 Self Crossing Solution Hard Math
334 Increasing Triplet Subsequence Solution Medium
333 Largest BST Subtree Solution Medium Tree
332 Reconstruct Itinerary Solution Medium Graph, DFS
331 Verify Preorder Serialization of a Binary Tree Solution Medium Stack
330 Patching Array Solution Hard Greedy
329 Longest Increasing Path in a Matrix Solution Hard DFS, DP
328 Odd Even Linked List Solution Medium Linked List
327 Count of Range Sum Solution Hard BST, Divide and Conquer
326 Power of Three Solution Easy Math
325 Maximum Size Subarray Sum Equals k Solution Medium HashTable
324 Wiggle Sort II Solution Medium Sort
323 Number of Connected Components in an Undirected Graph Solution Medium
322 Coin Change Solution Medium DP
321 Create Maximum Number Solution Hard
320 Generalized Abbreviation Solution Medium Backtracking, Bit Manipulation
319 Bulb Switcher Solution Medium Brainteaser
318 Maximum Product of Word Lengths Solution Medium
317 Shortest Distance from All Buildings Solution Hard
316 Remove Duplicate Letters Solution Hard Stack, Recursion, Greedy
315 Count of Smaller Numbers After Self Solution Hard Tree
314 Binary Tree Vertical Order Traversal Solution Medium HashMap, BFS
313 Super Ugly Number Solution Medium
312 Burst Balloons Solution Hard DP
311 Sparse Matrix Multiplication Solution Medium
310 Minimum Height Trees Solution Medium
309 Best Time to Buy and Sell Stock with Cooldown Solution Medium DP
308 Range Sum Query 2D - Mutable Solution Hard Tree
307 Range Sum Query - Mutable Solution Medium Tree
306 Additive Number Solution Medium
305 Number of Islands II Solution Hard Union Find
304 Range Sum Query 2D - Immutable Solution Medium
303 Range Sum Query - Immutable Solution Easy
302 Smallest Rectangle Enclosing Black Pixels Solution Hard DFS, BFS
301 Remove Invalid Parentheses Solution Hard BFS
300 Longest Increasing Subsequence Solution Medium DP
299 Bulls and Cows Solution Easy
298 Binary Tree Longest Consecutive Sequence Solution Medium Tree
297 Serialize and Deserialize Binary Tree Solution Hard BFS
296 Best Meeting Point Solution Hard
295 Find Median from Data Stream Solution Hard Heap
294 Flip Game II Solution Medium Backtracking
293 Flip Game Solution Easy
292 Nim Game Solution Easy
291 Word Pattern II Solution Hard Recursion, Backtracking
290 Word Pattern Solution Easy HashMap
289 Game of Life Solution 📺 Medium
288 Unique Word Abbreviation Solution Easy
287 Find the Duplicate Number Solution Medium
286 Walls and Gates Solution Medium BFS
285 Inorder Successor In BST Solution Medium Tree
284 Peeking Iterator Solution Medium Design
283 Move Zeroes Solution 📺 Easy
282 Expression Add Operators Solution Hard
281 Zigzag Iterator Solution Medium
280 Wiggle Sort Solution Medium
279 Perfect Squares Solution Medium
278 First Bad Version Solution 📺 Easy Binary Search
277 Find the Celebrity Solution Medium
276 Paint Fence Solution Easy DP
275 H-Index II Solution Medium Binary Search
274 H-Index Solution Medium
273 Integer to English Words Solution Hard Math, String
272 Closest Binary Search Tree Value II Solution Hard Stack
271 Encode and Decode Strings Solution Medium
270 Closest Binary Search Tree Value Solution Easy
269 Alien Dictionary Solution Hard
268 Missing Number Solution Easy
267 Palindrome Permutation II Solution Medium
266 Palindrome Permutation Solution Easy
265 Paint House II Solution Hard DP
264 Ugly Number II Solution Medium DP
263 Ugly Number Solution Easy
261 Graph Valid Tree Solution Medium
260 Single Number III Solution Medium
259 3Sum Smaller Solution Medium
258 Add Digits Solution Easy
257 Binary Tree Paths Solution DFS/Recursion
256 Paint House Solution Medium DP
255 Verify Preorder Sequence in Binary Search Tree Solution Medium Tree
254 Factor Combinations Solution Medium Backtracking
253 Meeting Rooms II Solution Medium Heap
252 Meeting Rooms Solution Easy
251 Flatten 2D Vector Solution Medium
250 Count Univalue Subtrees Solution Medium DFS
249 Group Shifted Strings Solution
248 Strobogrammatic Number III Solution Hard Recursion, DFS
247 Strobogrammatic Number II Solution Medium Recursion
246 Strobogrammatic Number Solution Easy
245 Shortest Word Distance III Solution Medium
244 Shortest Word Distance II Solution Medium HashMap
243 Shortest Word Distance Solution Easy
242 Valid Anagram Solution Easy
241 Different Ways to Add Parentheses Solution Medium Divide and Conquer
240 Search a 2D Matrix II Solution Medium Binary Search
239 Sliding Window Maximum Solution Hard Heap
238 Product of Array Except Self Solution Medium Array
237 Delete Node in a Linked List Solution 📺 Easy LinkedList
236 Lowest Common Ancestor of a Binary Tree Solution Medium DFS
235 Lowest Common Ancestor of a Binary Search Tree Solution Easy DFS
234 Palindrome Linked List Solution 📺 Easy Linked List
233 Number of Digit One Solution Hard Math
232 Implement Queue using Stacks Solution Medium Stack, Design
231 Power of Two Solution Easy
230 Kth Smallest Element in a BST Solution Medium Tree
229 Majority Element II Solution Medium
228 Summary Ranges Solution Medium Array
227 Basic Calculator II Solution Medium String
226 Invert Binary Tree Solution Easy DFS, recursion
225 Implement Stack using Queues Solution Easy Stack, Queue
224 Basic Calculator Solution Hard
223 Rectangle Area Solution Easy
222 Count Complete Tree Nodes Solution Medium Recursion
221 Maximal Square Solution Medium Recursion
220 Contains Duplicate III Solution 📺 Medium TreeSet
219 Contains Duplicate II Solution 📺 Easy HashMap
218 The Skyline Problem Solution Hard TreeMap, Design
217 Contains Duplicate Solution 📺 Easy HashSet
216 Combination Sum III Solution Medium Backtracking
215 Kth Largest Element in an Array Solution Medium Heap
214 Shortest Palindrome Solution Hard KMP
213 House Robber II Solution Medium DP
212 Word Search II Solution Hard Trie
211 Add and Search Word - Data structure design Solution Medium Trie
210 Course Schedule II Solution Medium
209 Minimum Size Subarray Sum Solution Medium
208 Implement Trie Solution Medium Trie
207 Course Schedule Solution Medium
206 Reverse Linked List Solution 📺 Easy Linked List
205 Isomorphic Strings Solution Easy
204 Count Primes Solution Easy The Sieve of Eratosthenes
203 Remove Linked List Elements Solution Easy
202 Happy Number Solution Easy
201 Bitwise AND of Numbers Range Solution Medium Bit Manipulation
200 Number of Islands Solution Medium Union Find, DFS
199 Binary Tree Right Side View Solution Medium BFS
198 House Robber Solution Easy DP
191 Number of 1 Bits Solution Easy Bit Manipulation
190 Reverse Bits Solution Easy Bit Manipulation
189 Rotate Array Solution 📺 Easy
188 Best Time to Buy and Sell Stock IV Solution Hard DP
187 Repeated DNA Sequences Solution Medium
186 Reverse Words in a String II Solution Medium
179 Largest Number Solution Medium
174 Dungeon Game Solution Hard DP
173 Binary Search Tree Iterator Solution Medium Stack, Design
172 Factorial Trailing Zeroes Solution Easy
171 Excel Sheet Column Number Solution Easy
170 Two Sum III - Data structure design Solution Easy
169 Majority Element Solution 📺 Easy
168 Excel Sheet Column Title Solution Easy
167 Two Sum II - Input array is sorted Java, Javascript Easy Binary Search
166 Fraction to Recurring Decimal Solution Medium HashMap
165 Compare Version Numbers Solution Easy
164 Maximum Gap Solution Hard
163 Missing Ranges Solution
162 Find Peak Element Solution Binary Search
161 One Edit Distance Solution
160 Intersection of Two Linked Lists Solution Easy Linked List
159 Longest Substring with At Most Two Distinct Characters Solution Hard String, Sliding Window
158 Read N Characters Given Read4 II - Call multiple times Solution Hard
157 Read N Characters Given Read4 Solution Easy
156 Binary Tree Upside Down Solution Medium Tree, Recursion
155 Min Stack Solution Easy Stack
154 Find Minimum in Rotated Sorted Array II Solution Hard Array, Binary Search
153 Find Minimum in Rotated Sorted Array Solution Medium Array, Binary Search
152 Maximum Product Subarray Solution Medium Array
151 Reverse Words in a String Solution Medium String
150 Evaluate Reverse Polish Notation Solution Medium
149 Max Points on a Line Solution Hard
147 Insertion Sort List Solution Medium Linked List
146 LRU Cache Solution Hard Doubly Linked List, LinkedHashMap
145 Binary Tree Postorder Traversal Solution 📺 Hard Binary Tree
144 Binary Tree Preorder Traversal Solution 📺 and 📺 Medium Binary Tree
143 Reorder List Solution Medium
142 Linked List Cycle II Solution Medium Linked List
141 Linked List Cycle Solution 📺 Easy Linked List
140 Word Break II Solution Hard Backtracking/DFS
139 Word Break Solution 📺 Medium DP, Pruning
138 Copy List with Random Pointer Solution Medium LinkedList, HashMap
137 Single Number II Solution Medium Bit Manipulation
136 Single Number Solution 📺 Easy Bit Manipulation
135 Candy Solution Hard Greedy
134 Gas Station Solution Medium Greedy
133 Clone Graph Solution Medium HashMap, BFS, Graph
132 Palindrome Partitioning II Solution Hard
131 Palindrome Partitioning Solution Medium
130 Surrounded Regions Solution Medium
129 Sum Root to Leaf Numbers Solution Medium DFS
128 Longest Consecutive Sequence Solution Hard Union Find
127 Word Ladder Solution Medium BFS
126 Word Ladder II Solution Hard BFS
125 Valid Palindrome Solution Easy Two Pointers
124 Binary Tree Maximum Path Sum Solution Hard Tree, DFS
123 Best Time to Buy and Sell Stock III Solution Hard DP
122 Best Time to Buy and Sell Stock II Solution Easy Greedy
121 Best Time to Buy and Sell Stock Solution Easy
120 Triangle Solution Medium DP
119 Pascal's Triangle II Solution 📺 Easy
118 Pascal's Triangle Solution 📺 Easy
117 Populating Next Right Pointers in Each Node II Solution Medium BFS
116 Populating Next Right Pointers in Each Node Solution Medium BFS
115 Distinct Subsequences Solution Hard DP
114 Flatten Binary Tree to Linked List Solution Medium Tree
113 Path Sum II Solution Medium DFS, Backtracking
112 Path Sum Solution Easy DFS
111 Minimum Depth of Binary Tree Solution Easy BFS, DFS
110 Balanced Binary Tree Solution Easy DFS
109 Convert Sorted List to Binary Search Tree Solution Medium DFS, Recursion
108 Convert Sorted Array to Binary Search Tree Solution 📺 Easy Tree
107 Binary Tree Level Order Traversal II Solution Easy BFS
106 Construct Binary Tree from Inorder and Postorder Traversal Solution Medium Recursion, Tree
105 Construct Binary Tree from Preorder and Inorder Traversal Solution Medium Recursion, Tree
104 Maximum Depth of Binary Tree Solution 📺 Easy DFS
103 Binary Tree Zigzag Level Order Traversal Solution Medium BFS,DFS
102 Binary Tree Level Order Traversal Solution 📺 Medium BFS
101 Symmetric Tree Solution 📺 Easy DFS
100 Same Tree Solution 📺 Easy DFS
99 Recover Binary Search Tree Solution Hard
98 Validate Binary Search Tree Solution 📺 Medium DFS/Recursion
97 Interleaving String Solution Hard DP
96 Unique Binary Search Trees Solution Medium Recursion, DP
95 Unique Binary Search Trees II Solution Medium Recursion
94 Binary Tree Inorder Traversal Solution 📺 📺 Medium Binary Tree
93 Restore IP Addresses Solution Medium Backtracking
92 Reverse Linked List II Solution Medium
91 Decode Ways Solution Medium DP
90 Subsets II Solution Medium Backtracking
89 Gray Code Solution Medium Bit Manipulation
88 Merge Sorted Array Solution Easy
87 Scramble String Solution Hard Recursion
86 Partition List Solution Medium Linked List
85 Maximal Rectangle Solution Hard DP
84 Largest Rectangle in Histogram Solution Hard Array, Stack
83 Remove Duplicates from Sorted List Solution Easy Linked List
82 Remove Duplicates from Sorted List II Solution Medium Linked List
81 Search in Rotated Sorted Array II Solution Medium Binary Search
80 Remove Duplicates from Sorted Array II Solution Medium
79 Word Search Solution Medium Backtracking, DFS
78 Subsets Solution Medium Backtracking
77 Combinations Solution Medium Backtracking
76 Minimum Window Substring Solution Hard Two Pointers
75 Sort Colors Solution Medium Two Pointers
74 Search a 2D Matrix Solution Medium Binary Search
73 Set Matrix Zeroes Solution Medium
72 Edit Distance Solution Hard
71 Simplify Path Solution Medium Stack
70 Climbing Stairs Solution 📺 Easy DP
69 Sqrt(x) Solution Easy
68 Text Justification Solution Hard
67 Add Binary Solution Easy
66 Plus One Solution 📺 Easy
65 Valid Number Solution Hard
64 Minimum Path Sum Solution Medium DP
63 Unique Paths II Solution Medium DP
62 Unique Paths Solution Medium DP
61 Rotate List Solution Medium Linked List
60 Permutation Sequence Solution Medium Math, Backtracking
59 Spiral Matrix II Solution 📺 Medium
58 Length of Last Word Solution Easy
57 Insert Intervals Solution Hard Array, Sort
56 Merge Intervals Solution Medium Array, Sort
55 Jump Game Solution Medium Greedy
54 Spiral Matrix Solution 📺 Medium Array
53 Maximum Subarray Solution Easy Array
52 N-Queens II Solution Hard Backtracking
51 N-Queens Solution Hard
50 Pow(x, n) Solution Medium
49 Group Anagrams Solution Medium HashMap
48 Rotate Image Solution 📺 Medium Array
47 Permutations II Solution Medium Backtracking
46 Permutations Solution Medium Backtracking
45 Jump Game II Solution Hard Array, Greedy
44 Wildcard Matching Solution Hard Backtracking, DP, Greedy, String
43 Multiply Strings Solution Medium Array, String
42 Trapping Rain Water Solution Hard
41 First Missing Positive Solution Hard Array
40 Combination Sum II Solution Medium Backtracking
39 Combination Sum Solution Medium Backtracking
38 Count and Say Solution Easy Recursion, LinkedList
37 Sudoku Solver Solution Hard
36 Valid Sudoku Solution Medium
35 Search Insert Position Solution Easy Array
34 Search for a Range Solution Medium Array, Binary Search
33 Search in Rotated Sorted Array Solution Medium Binary Search
32 Longest Valid Parentheses Solution Hard Stack, DP
31 Next Permutation Solution, C++ Medium Array
30 Substring with Concatenation of All Words Solution Hard HashMap
29 Divide Two Integers Solution Medium
28 Implement strStr() Solution Easy String
27 Remove Element Solution Easy
26 Remove Duplicates from Sorted Array Solution 📺 Easy Array
25 Reverse Nodes in k-Group Solution Hard Recursion, LinkedList
24 Swap Nodes in Pairs Solution Medium Recursion, LinkedList
23 Merge k Sorted Lists Solution 📺 Hard Heap
22 Generate Parentheses Solution Medium Backtracking
21 Merge Two Sorted Lists Solution 📺 Easy Recursion
20 Valid Parentheses Solution 📺 Easy Stack
19 Remove Nth Node From End of List Solution 📺 Medium Linked List
18 4 Sum Solution Medium Two Pointers
17 Letter Combinations of a Phone Number Solution Medium Backtracking
16 3Sum Closest Solution Medium Two Pointers
15 3Sum Solution, C++ 📺 Medium Two Pointers, Binary Search
14 Longest Common Prefix Solution 📺 Easy
13 Roman to Integer Solution Easy Math, String
12 Integer to Roman Solution Medium Math, String
11 Container With Most Water Solution Medium
10 Regular Expression Matching Java, Javascript Hard DP
9 Palindrome Number Java, C++ Easy
8 String to Integer (atoi) Solution Medium
7 Reverse Integer Solution, C++ 📺 Easy
6 ZigZag Conversion Solution Easy
5 Longest Palindromic Substring Solution Medium
4 Median of Two Sorted Arrays Solution, C++ Hard Divide and Conquer
3 Longest Substring Without Repeating Characters Solution, C++ Medium HashMap, Sliding Window
2 Add Two Numbers Solution Medium LinkedList
1 Two Sum Java, C++, Javascript 📺 Easy HashMap

Database

# Title Solutions Video Difficulty Tag
1543 Fix Product Name Format Solution Easy
1517 Find Users With Valid E-Mails Solution Easy
1495 Friendly Movies Streamed Last Month Solution Easy
1484 Group Sold Products By The Date Solution Easy
1407 Top Travellers Solution Easy
1384 Total Sales Amount by Year Solution Hard
1378 Replace Employee ID With The Unique Identifier Solution Easy
1369 Get the Second Most Recent Activity Solution Hard
1364 Number of Trusted Contacts of a Customer Solution Medium
1355 Activity Participants Solution Medium
1350 Students With Invalid Departments Solution Easy
1341 Movie Rating Solution Medium
1327 List the Products Ordered in a Period Solution Easy
1322 Ads Performance Solution Easy
1308 Running Total for Different Genders Solution Medium
1303 Find the Team Size Solution Easy
1294 Weather Type in Each Country Solution Easy
1285 Find the Start and End Number of Continuous Ranges Solution Medium
1280 Students and Examinations Solution 📺 Easy
1270 All People Report to the Given Manager Solution Medium
1251 Average Selling Price Solution Easy
1241 Number of Comments per Post Solution Easy
1179 Reformat Department Table Solution Easy
1173 Immediate Food Delivery I Solution Easy
1148 Article Views I Solution Easy
1141 User Activity for the Past 30 Days I Solution Easy
1084 Sales Analysis III Solution Easy
1083 Sales Analysis II Solution Easy
1082 Sales Analysis I Solution Easy
1076 Project Employees II Solution Easy
1075 Project Employees I Solution Easy
1069 Product Sales Analysis II Solution Easy
1068 Product Sales Analysis I Solution Easy
1050 Actors and Directors Who Cooperated At Least Three Times Solution Easy
627 Swap Salary Solution Easy
626 Exchange Seats Solution Medium
620 Not Boring Movies Solution Easy
619 Biggest Single Number Solution Easy
618 Students Report By Geography Solution Hard Session Variables
615 Average Salary: Departments VS Company Solution Hard
614 Second Degree Follower Solution Medium Inner Join
613 Shortest Distance in a Line Solution Easy
612 Shortest Distance in a Plane Solution Medium
610 Triangle Judgement Solution Easy
608 Tree Node Solution Medium Union
607 Sales Person Solution Easy
603 Consecutive Available Seats Solution Easy
602 Friend Requests II: Who Has the Most Friends Solution Medium
601 Human Traffic of Stadium Solution Hard
597 Friend Requests I: Overall Acceptance Rate Solution Easy
596 Classes More Than 5 Students Solution Easy
595 Big Countries Solution Easy
586 Customer Placing the Largest Number of Orders Solution Easy
585 Investments in 2016 Solution Medium
584 Find Customer Referee Solution Easy
580 Count Student Number in Departments Solution Medium Left Join
578 Get Highest Answer Rate Question Solution Medium
577 Employee Bonus Solution Easy
574 Winning Candidate Solution Medium
571 Find Median Given Frequency of Numbers Solution Hard
570 Managers with at Least 5 Direct Reports Solution Medium
569 Median Employee Salary Solution Hard
534 Game Play Analysis III Solution Easy
512 Game Play Analysis II Solution Easy
511 Game Play Analysis I Solution Easy
262 Trips and Users Solution Hard Inner Join
197 Rising Temperature Solution Easy
196 Delete Duplicate Emails Solution Easy
185 Department Top Three Salaries Solution Hard
184 Department Highest Salary Solution Medium
183 Customers Who Never Order Solution Easy
182 Duplicate Emails Solution Easy
181 Employees Earning More Than Their Managers Solution Easy
180 Consecutive Numbers Solution Medium
178 Rank Scores Solution Medium
177 Nth Highest Salary Solution Medium
176 Second Highest Salary Solution Easy
175 Combine Two Tables Solution Easy

Shell

# Title Solutions Video Difficulty Tag
195 Tenth Line Solution Easy
194 Transpose File Solution Medium
193 Valid Phone Numbers Solution Easy
192 Word Frequency Solution Medium

Contributing

Your ideas/fixes/algorithms are more than welcome!

  1. Please make sure your PR builds after submitting! Check out here: https://travis-ci.org/github/fishercoder1534/Leetcode/pull_requests and look for your PR build.
  2. Fork this repo
  3. Clone your forked repo (git clone https://github.com/YOUR_GITHUB_USERNAME/Leetcode.git) onto your local machine
  4. cd into your cloned directory, create your feature branch (git checkout -b my-awesome-fix)
  5. git add your desired changes to this repo
  6. Commit your changes (git commit -m 'Added some awesome features/fixes')
  7. Push to the branch (git push origin my-awesome-feature)
  8. Open your forked repo on Github website, create a new Pull Request to this repo!

Best way to open this project

  1. Install IntelliJ on your machine, either CE or UE.
  2. git clone this repo to your local disk
  3. import this project as a new project (does need to be imported as a gradle project)
  4. If you run into "Could not determine Java version using executable ..." error, use local gradle distribution: "/usr/local/Cellar/gradle/4.8.1/libexec/" instead of the default one. More details, see this question on Stackoverflow.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (29,540) 
mysql (923) 
bash (567) 
algorithm (452) 
data-structures (333) 
interview (222) 
leetcode (163) 
apache (107) 
leetcode-solutions (59) 
leetcode-java (16) 

Find Open Source By Browsing 7,000 Topics Across 59 Categories