Skip to content

roeishc/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

LeetCode

Resources

  1. AlgoMonster - Questions/subjetcs patterns in coding interviews.
    • Includes specific data for Amazon, Apple, Google, Meta.
    • Includes ROI for different subjects in terms of time investments.
    • Flow chart of how to approach a problem.
    • Honestly, a lot more.
  2. InterviewBit - Similar to LeetCode.
    • Shows company questions for free.
    • Has a focus on timing solutions.
  3. NeetCode.io, NeetCode YouTube channel.
    • Subjects roadmap for learning and practicing.
    • NeetCode 75 & NeetCode 150 for interview preparations.
    • Videos of detailed solutions with explanations - both intuitively and programmatically.
    • Strategy of learning and solving LeetCode questions.

Solutions

LeetCode profile

Solutions to the LeetCode problems I solved/studied so far:

# Title Solution Difficulty Notes
3 Longest Substring Without Repearing Characters Python3 Medium Sliding Window
13 Roman to Integer Python3 Easy
20 Valid Parentheses Java Easy
40 Combination Sum II Python3 Medium
41 First Missing Positive C Hard
42 Trapping Rain Water Python3 Hard Solution using arrays
Solution using two pointers
50 Pow(x, n) Python3 Medium
56 Merge Intervals Python3 Medium
69 Sqrt(x) Java Easy
75 Sort Colors Python3 Medium Counting Sort (two-pass),
Two pointers (one-pass)
78 Subsets Python3 Medium
94 Binary Tree Inorder Traversal Java Easy
118 Pascal's Triangle Python3 Easy
131 Palindrome Partitioning Python3 Medium
136 Single Number C Easy
137 Single Number II C Medium
140 Word Break II Python3 Hard
141 Linked List Cycle Java Easy
145 Binary Tree Postorder Traversal Python3 Easy
146 LRU Cache Python3 Medium Ordered Dictionary, Doubly Linked List & Hashmap
165 Compare Version Numbers Python3 Medium
179 Largest Number Python3 Medium
200 Number of Islands Python3 Medium BFS on a matrix
206 Reverse Linked List C Easy
214 Shortest Palindrome Python3 Hard Rabin–Karp algorithm
215 Kth Largest Element in an Array Python3 Medium One liner
237 Delete Node in a Linked List Python3 Medium
241 Different Ways to Add Parentheses Python3 Medium
260 Single Number III C Medium
264 Ugly Number II Python3 Medium Mathematical properties
273 Integer to English Words Python3 Hard
287 Find the Duplicate Number C Medium Floyd's cycle detection
330 Patching Array Python3 Hard Mathematical properties
338 Counting Bits C Easy
344 Reverse String C Easy
350 Intersection of Two Arrays II Python3 Easy
386 Lexicographical Numbers Python3 Medium
409 Longest Palindrome Python3 Easy
432 All O`one Data Structure Python3 Medium
440 K-th Smallest in Lexicographical Order Python3 Hard
476 Number Complement Python3 Easy
502 IPO Python3 Hard
506 Relative Ranks Python3 Easy
523 Continuous Subarray Sum Java Medium Mathematical properties
539 Minimum Time Difference Python3 Medium
552 Student Attendance Record II Java Hard
564 Find the Closest Palindrome Python3 Hard
567 Permutation in String Java Medium
590 N-ary Tree Postorver Traversal Python3 Easy
592 Fraction Addition and Subtraction Python3 Medium
624 Maximum Distance in Arrays Python3 Medium
632 Smallest Range Covering Elements from K Lists Python3 Hard
633 Sum of Square Numbers Python3 Medium Mathematical properties
641 Design Circular Deque Python3 Medium
648 Replace Words Python3 Medium
650 2 Keys Keyboard Python3 Medium Dynamic Programming
664 Strange Printer Python3 Hard Dynamic Programming
670 Maximum Swap Python3 Medium
703 Kth Largest Element in a Stream Python3 Easy
719 Find K-th Smallest Pair Distance Python3 Hard Sliding Window & Binary Search on the result
725 Split Linked List in Parts Python3 Medium
726 Number of Atoms Python3 Hard Parsing string
729 My Calendar I Python3 Medium
731 My Calendar II Python3 Medium
771 Jewels and Stones Python3 Easy
786 K-th Smallest Prime Fraction C Medium
796 Rotate String Java Easy
826 Most Profit Assigning Work Python3 Medium
840 Magic Squares In Grid Python3 Medium
846 Hand of Straights Python3 Medium
857 Minimum Cost to Hire K Workers Python3 Hard
860 Lemonade Change Python3 Easy
861 Score After Flipping Matrix Python3 Medium
862 Shortest Subarray with Sum at Least K Python3 Hard
874 Walking Robot Simulation Python3 Medium
881 Boats to Save People Python3 Medium
884 Uncommon Words from Two Sentences Python3 Easy
885 Spiral Matrix III Python3 Medium
912 Sort an Array Python3 Medium Implement sorting algorithm without built-in functions.
Merge Sort, Heap Sort, Counting Sort
921 Minimum Add to Make Parentheses Valid Python3 Medium
938 Range Sum of BST C Easy
945 Minimum Increment to Make Array Unique Python3 Medium
947 Most Stones Removed with Same Row or Column Python3 Medium Union Find
951 Flip Equivalent Binary Trees Python3 Medium
959 Regions Cut By Slashes Python3 Medium Question can be mapped to Number of Islands (#200)
962 Maximum Width Ramp Python3 Medium
973 K Closest Points to Origin Python3 Medium Heap / sort by lambda function
974 Subarray Sum Divisible by K Java, Python3 Medium
979 Distribute Coins in Binary Tree C Medium DFS
995 Minimum Number of K Consecutive Bit Flips Python3 Hard Sliding Window &
Bit Manipulation
Great editorial
1002 Find Common Characters Java Easy
1038 Binary Search Tree to Greater Sum Tree Python3 Medium BST, DFS
1051 Height Checker Java, Python3 Easy Counting Sort
1052 Grumpy Bookstore Owner Python3 Medium Sliding Window
1072 Flip Columns for Maximum Number of Equal Rows Python3 Medium
1105 Filling Bookcase Shelves Python3 Medium Dynamic Programming
1106 Parsing A Boolean Expression Python3 Hard
1110 Delete Nodes and Return Forest Python3 Medium
1122 Relative Sort Array Python3 Easy
1140 Stone Game II Python3 Medium Dynamic Programming
1190 Reverse Substrings Between Each Pair of Parentheses Python3 Medium
1208 Get Equal Substrings Within Budget C Medium Sliding Window
1219 Path with Maximum Gold Java Medium DFS & Backtracking
1233 Remove Sub-Folders from the Filesystem Python3 Medium
1248 Count Number of Nice Subarrays Python3 Medium Sliding Window
1255 Maximum Score Words Formed by Letters C Hard
1268 Search Suggestions System Python3 Medium
1277 Count Square Submatrices with All Ones Python3 Medium
1310 XOR Queries of a Subarray Python3 Medium
1325 Delete Leaves With a Given Value C Medium DFS
1331 Rank Transform of an Array Java Easy
1334 Find the City With the Smallest Number of Neighbors at a Threshold Distance Python3 Medium Shortest Path from every node to every node.
Dijkstra's algorithm, Floyd-Warshall algorithm
1342 Number of Steps to Reduce a Number to Zero Python3 Easy
1367 Linked List in Binary Tree Python3 Medium
1371 Find the Longest Substring Containing Vowels in Even Counts Python3 Medium
1380 Lucky Numbers in a Matrix Python3 Easy
1381 Design a Stack With Increment Operation Python3, Java Medium
1382 Balance a Binary Search Tree Python3 Medium
1395 Count Number of Teams Python3 Medium
1404 Number of Steps to Reduce a Number in Binary Representation to One C Medium
1405 Longest Happy String Python3 Medium
1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Python3 Medium Sliding Window with 2 Heaps
1442 Count Triplets That Can Form Two Arrays of Equal XOR C Medium
1460 Make Two Arrays Equal by Reversing Subarrays Python3 Easy
1480 Running Sum of 1d Array Java Easy
1482 Minimum Number of Days to Make m Bouquets Python3 Medium
1486 XOR Operation in an Array Python3 Easy
1497 Check If Array Pairs Are Divisible by K Java Medium
1508 Range Sum of Sorted Subarray Sums Python3 Medium
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Python3 Medium
1512 Number of Good Pairs Go Easy
1514 Path with Maximum Probability Python3 Medium Maximizing probability instead of minimizing distance.
Dijkstra's algorithm, Bellman-Ford algorithm
1518 Water Bottles Python3 Easy Mathematical properties
1530 Number of Good Leaf Nodes Pairs Python3 Medium DFS, Shortest Path between nodes
1545 Find Kth Bit in Nth Binary String Python3 Medium
1550 Three Consecutive Odds Python3 Easy
1552 Magnetic Force Between Two Balls Python3 Medium Binary Search
1568 Minimum Number of Days to Disconnect Island Python3 Hard
1574 Shortest Subarray to be Removed to Make Array Sorted Python3 Medium
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Python3 Hard Union Find, Graph
1590 Make Sum Divisible by P Java Medium
1593 Split a String Into the Max Number of Unique Substrings Python3 Medium
1598 Crawler Log Folder Python3 Easy
1605 Find Valid Matrix Given Row and Column Sums Python3 Medium
1608 Special Array With X Elements Greater Than or Equal X Python3, C Easy Python3: Sorting
C: Suffix Sum
1636 Sort Array by Increasing Frequency Python3 Easy
1641 Count Sorted Vowel Strings Python3 Medium Dynamic Programming
1652 Defuse the Bomb Python3 Easy
1653 Minimum Deletions to Make String Balanced Python3 Medium
1671 Minimum Number of Removals to Make Mountain Array Python3 Hard
1684 Count the Number of Consistent Strings Python3, Java Easy
1689 Partitioning Into Minimum Number of Deci-Binary Numbers Java Medium
1701 Average Waiting Time Python3 Medium
1717 Maximum Score From Removing Substrings Python3 Medium
1720 Decode XORed Array Python3 Easy
1791 Find Center of Star Graph Python3 Easy
1813 Sentence Similarity III Python3 Medium
1823 Find the Winner of the Circular Game Python3 Medium Mathematical properties
1829 Maximum XOR for Each Query Java Medium
1863 Sum of All Subset XOR Totals Java, C Easy Java: trivial, inefficient
C: Black magic AKA bit manipulation
1894 Find the Student that Will Replace the Chalk Python3 Medium
1905 Count Sub Islands Python3 Medium
1937 Maximum Number of Points with Cost Python3 Medium Dynamic Programming
1942 The Number of the Smallest Unoccupied Chair Python3 Medium Two heaps
1945 Sum of Digits of String After Convert Python3 Easy
1957 Delete Characters to Make Fancy String Python3 Easy
1963 Minimum Number of Swaps to Make the String Balanced Python3 Medium
2000 Reverse Prefix of Word C Easy
2022 Convert 1D Array Into 2D Array Python3 Easy
2028 Find Missing Observations Python3 Medium Mathematical properties
2037 Minimum Number of Moves to Seat Everyone Python3 Easy
2044 Count Number of Maximum Bitwise-OR Subsets Python3 Medium
2045 Second Minimum Time to Reach Destination Python3 Hard BFS with extra conditions
2053 Kth Distinct String in an Array Python3 Easy
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Python3 Medium
2064 Minimized Maximum of Products Distributed to Any Store Python3 Medium
2070 Most Beautiful Item for Each Query Python3 Medium
2096 Step-By-Step Direction From a Binary Tree Node to Another Python3 Medium BFS
2134 Minimum Swaps to Group All 1's Together II Python3 Medium
2181 Merge Nodes in Between Zeros Python3 Medium
2191 Sort the Jumbled Numbers Python3 Medium
2192 All Ancestors of a Node in a Directed Acyclic Graph Python3 Medium
2196 Create Binary Tree From Descriptions Python3 Medium
2220 Minimum Bit Flips to Convert Number Python3, Java Easy
2248 Intersection of Multiple Arrays Python3 Easy
2257 Count Unguarded Cells in the Grid Python3 Medium
2275 Largest Combination With Bitwise AND Greater Than Zero Java Medium
2285 Maximum Total Importance of Roads Python3 Medium Undirected Graph, Greedy
2326 Spiral Matrix IV Python3 Medium
2331 Evaluate Boolean Binary Tree C Easy
2373 Largest Local Value in a Matrix Java Easy
2392 Build a Matrix With Conditions Python3 Hard Topological Sort, DFS
2406 Divide Intervals Into Minimum Number of Groups Python3 Medium
2416 Sum of Prefix Scores of Strings Python3 Hard Trie / Prefix Tree
2418 Sort the People Python3 Easy
2419 Longest Subarray With Maximum Bitwise AND Python3 Medium
2441 Largest Positive Integer That Exists With Its Negative Python3 Easy
2458 Height of Binary Tree After Subtree Removal Queries Python3 Hard
2461 Maximum Sum of Distinct Subarrays With Length K Python3 Medium
2463 Minimum Total Distance Traveled Python3 Hard
2469 Convert the Temperature Go Easy
2486 Append Characters to String to Make Subsequence C Medium
2487 Remove Nodes From Linked List Java Medium Monotonic Stack
2490 Circular Sentence Python3 Easy
2491 Divide Players Into Teams of Equal Skill Java Medium
2501 Longest Square Streak in an Array Python3 Medium
2516 Take K of Each Character From Left and Right Python3 Medium
2530 Maximal Score After Applying K Operations Python3 Medium
2563 Count the Number of Fair Pairs Python3 Medium
2574 Left and Right Sum Differences Java Easy
2582 Pass the Pillow Python3 Easy Mathematical properties
2583 Kth Largest Sum in a Binary Tree Python3 Medium
2597 The Number of Beautiful Subsets Python3 Medium Backtracking
2601 Prime Subtraction Operation Python3 Medium
2641 Cousins in Binary Tree II Python3 Medium
2657 Find the Prefix Common Array of Two Arrays Java Medium
2678 Number of Senior Citizens Python3 Easy
2684 Maximum Number of Moves in a Grid Python3, Java Medium
2696 Minimum String Length After Removing Substrings Python3 Easy
2699 Modify Graph Edge Weights Python3 Hard Dijkstra's algorithm
2707 Extra Characters in a String Python3 Medium Trie / Prefix Tree
2751 Robot Collisions Python3 Hard
2807 Insert Greatest Common Divisors in Linked List Python3 Medium
2812 Find the Safest Path in a Grid Java Medium Multi-source BFS
2816 Double a Number Represented as a Linked List C Medium
2859 Sum of Values at Indices With K Set Bits Python3 Easy
2886 Change Data Type Python3 Easy
2914 Minimum Number of Changes to Make Binary String Beautiful Python3 Medium
2938 Separate Black and White Balls Python3 Medium
2952 Minimum Number of Coins to be Added Python3 Medium Mathematical properties
2976 Minimum Cost to Convert String I Python3 Medium Dijkstra's algorithm, Floyd-Warshall algorithm
3011 Find if Array Can Be Sorted Java Medium
3016 Minimum Number of Pushes to Type Word II Python3 Medium
3043 Find the Length of the Longest Common Prefix Python3 Medium
3068 Find the Maximum Sum of Node Values C Hard
3075 Maximize Happiness of Selected Children Java, Python3 Medium Java: Max Heap
Python3: Sorting
3097 Shortest Subarray With OR at Least K II Python3 Medium
3110 Score of a String Java Easy
3133 Minimum Array End Java Medium
3163 String Compression III Python3 Medium
3217 Delete Nodes From Linked List Present in Array Python3 Medium
3254 Find the Power of K-Size Subarrays I Python3 Medium

About

LeetCode solutions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published