Articles tagged with Medium
- Make Sum Divisible by P - Two Sum logic on prefix mod, published 2024-10-06
- LRU Cache - Implementing an LRU Cache in C++: Step-by-Step Guide with Code Examples, published 2024-07-11
- Most Frequent Subtree Sum - Plain and simple DFS, published 2024-05-08
- Maximum Good Subarray Sum - Prefix Sum + HashMap, published 2024-02-05
- Partition Array for Maximum Sum - Top down and bottom up DP, published 2024-02-03
- Out of Boundary Paths - DFS + Recursive Memoization, published 2024-01-26
- Pseudo-Palindromic Paths in a Binary Tree - Simple DFS with palindrome test at leaves, published 2024-01-24
- Insert Delete GetRandom O(1) - Swap with last element, published 2024-01-16
- Partition Labels - Greedy logic, published 2023-12-23
- Minimum Cost to Make Array Equalindromic - Check one palindrome on each side of median, published 2023-12-18
- Largest Submatrix With Rearrangements - Permute histogram bars to maximize area, published 2023-11-26
- Diagonal Traverse II - Short and clean five lines of code using TreeMap, published 2023-11-22
- Restore the Array From Adjacent Pairs - Create graph and run DFS, published 2023-11-10
- Count Nodes Equal to Average of Subtree - Simple recursion in O(n) TC, published 2023-11-02
- Longest Palindromic Substring - Boolean DP, published 2023-10-27
- Design Add and Search Words Data Structure - Trie structure, published 2023-10-27
- Binary Trees With Factors - DP on sorted array, published 2023-10-26
- K-th Symbol in Grammar - Simple Recursion, published 2023-10-25
- Find Largest Value in Each Tree Row - BFS and DFS solutions, published 2023-10-24
- Validate Binary Tree Nodes - DFS solution, published 2023-10-17
- Maximum Number of Jumps to Reach the Last Index - DP based solution, published 2023-07-10
- Unique Binary Search Trees II - Recursion and memoization DP, published 2023-06-20
- Special Permutations - DP with bitmask, published 2023-06-20
- Movement of Robots - Collision means nothing, published 2023-06-15
- Maximum Level Sum of a Binary Tree - BFS in Java, published 2023-06-15
- Unique Paths II - Top down and bottom up DP, published 2023-06-09
- Multiply Strings - Simple string operations and heuristics, published 2023-06-08
- Extra Characters in a String - Top-down and Bottom-up DP, published 2023-05-29
- Find the Punishment Number of an Integer - Recursion using just integers, published 2023-05-21
- Evaluate Division - DFS + BFS + DSU solutions, published 2023-05-20
- Combination Sum IV - DFS Recursive Memoization, published 2023-05-20
- Combination Sum - DFS Recursion, published 2023-05-18
- Combination Sum III - DFS Recursion, published 2023-05-18
- Combination Sum II - DFS Recursion, published 2023-05-18
- Maximum Number of Moves in a Grid - DFS + BFS + DP solutions, published 2023-05-17
- Neighboring Bitwise XOR - Simple O(n) solution, published 2023-05-15
- Count the Number of Complete Components - DFS + BFS + DSU solutions, published 2023-05-14
- Count Ways To Build Good Strings - Top-down and bottom-up DP with intuition, published 2023-05-13
- Solving Questions With Brainpower - Top-down and bottom-up DP with intuition, published 2023-05-12
- Dota2 Senate - Simulation using Queue, published 2023-05-04
- Range Sum Query - Mutable - Segment tree in C++ and Java, published 2023-05-01
- Number of Provinces - Union Find in C++ and Java, published 2023-04-29
- Bulb Switcher - Easy explanation, published 2023-04-27
- Smallest Number in Infinite Set - Hashset, Min heap based solutions, published 2023-04-25
- Maximum Width of Binary Tree - Step by step BFS, published 2023-04-24
- Reduction Operations to Make the Array Elements Equal - Sort and count using hashmap [Short + Easy], published 2023-04-19
- Minimum Additions to Make Valid String - Multiple solutions explained, published 2023-04-18
- Cousins in Binary Tree II - DFS solution + BFS solution, published 2023-04-15
- Longest Palindromic Subsequence - Bottom-up DP explained, published 2023-04-14
- Longest Palindromic Subsequence - Bottom-up + Top-down DP explained, published 2023-04-14
- Simplify Path - Short stack solution, published 2023-04-12
- Removing Stars From a String - Simple stack solution, published 2023-04-11
- Design Browser History - Simple array solution [Easy + Short], published 2023-03-18
- Convert Sorted List to Binary Search Tree - An elegant solution, published 2023-03-11
- String Compression - Simple two pointer solution, published 2023-03-02
- Construct Quad Tree - 3 ways to do recursion, flyweight pattern, published 2023-02-27
- Minimum Impossible OR - First missing positive + Bit manipulation [Easy to understand], published 2023-02-22
- Capacity To Ship Packages Within D Days - Binary search with proper explanation, published 2023-02-22
- 4Sum - K Sum solution explained, published 2023-02-22
- Count the Number of Square-Free Subsets - No DFS, No DP, Just Bitmask + simple counting, published 2023-02-21
- Substring XOR Queries - Clean HashMap solution, published 2023-02-13
- As Far from Land as Possible - Multi Source BFS, published 2023-02-10
- Fruit Into Baskets - Reaching the best solution, published 2023-02-07
- Zigzag Conversion - Easy Method, published 2023-02-03
- Increment Submatrices by One - Cumulative Sum, published 2023-01-15
- Sum of Subarray Minimums - Monotonic Stack + DP, published 2023-01-06
- Longest Absolute File Path - Monotonic stack solution explained, published 2022-12-29
- Keys and Rooms - DFS + BFS solutions, published 2022-12-20
- Daily Temperatures - Monotonic stack, published 2022-12-20
- Is Graph Bipartite? - BFS, published 2022-11-19
- Rectangle Area - Overlapping intervals expand idea from 1D, published 2022-11-17
- Count Complete Tree Nodes - Recursivle solution with explanation, published 2022-11-16
- Reverse Words in a String - ✅ ✅ ✅ One Liner, published 2022-11-13
- Minimum Number of Operations to Sort a Binary Tree by Level - BFS + Min swaps to sort, published 2022-11-13
- Where Will the Ball Fall - Just play the game!, published 2022-11-01
- Unique Binary Search Trees - [100%] Easy DP, published 2022-10-25
- Rotting Oranges - Easy BFS, published 2022-10-25
- Path Sum III - Easy DFS, published 2022-10-25
- Partition Labels - Greedy Solution, published 2022-10-25
- Palindromic Substrings - C++ DP with explanation, published 2022-10-25
- Minimum Path Sum - Easy O(m*n), published 2022-10-25
- Find Minimum in Rotated Sorted Array - Iterative binary search, published 2022-10-25
- Decode String - C++ Stack 100%, published 2022-10-25
- Binary Tree Right Side View - Easy BFS, published 2022-10-25
- Word Break - Easy Concise DP, published 2022-10-21
- Wiggle Sort II - Trial and Error, published 2022-10-21
- Insert Delete GetRandom O(1) - Simple Hashset, published 2022-10-21
- Fraction to Recurring Decimal - [Faster than 100%] Easy + Concise C++ Step by step, published 2022-10-21
- Factorial Trailing Zeroes - [Easy] One liner, published 2022-10-21
- Top K Frequent Words - [C++,Python(3/1 lines)] Two methods: Sorting / Max heap, published 2022-10-19
- Search a 2D Matrix II - Top right to bottom left, published 2022-10-18
- Min Stack - Beauty of OOP, published 2022-10-18
- Surrounded Regions - Island method [DFS], published 2022-10-17
- Number of Islands - Easy DFS, published 2022-10-17
- Count Primes - Sieve of Eratosthenes with Exaplanation, published 2022-10-15
- Populating Next Right Pointers in Each Node - BFS+Queue O(1) space, O(n) time, published 2022-10-14
- Delete the Middle Node of a Linked List - One pass tortoise and hare, published 2022-10-14
- Word Search - Help needed for DFS solution, published 2022-10-13
- Flatten Nested List Iterator - Simple Recursion, published 2022-10-13
- Delete Node in a Linked List - 3 solutions, published 2022-10-13
- Course Schedule II - [Two methods] Kahn's Algorithm and DFS, published 2022-10-12
- Copy List with Random Pointer - C++ Hashmap, published 2022-10-11
- Break a Palindrome - [6 liner] Simple logic simple solution, published 2022-10-10
- Time Based Key-Value Store - HashMap + Ordered Map, published 2022-10-06
- Binary Tree Zigzag Level Order Traversal - BFS using Queue, published 2022-10-06
- Add One Row to Tree - Easy to understand DFS solution, published 2022-10-05
- Spiral Matrix - Spiral traversal, published 2022-10-04
- Search in Rotated Sorted Array - Faster than 100% -- Rotation pivot using binary search, published 2022-10-04
- Longest Increasing Subsequence - Two DP solutions, published 2022-10-04
- Largest Divisible Subset - DP faster than 95%, published 2022-10-04
- Group Anagrams - Easy hashmap, published 2022-10-04
- Count and Say - Two pointer solution, published 2022-10-04
- Number of Dice Rolls With Target Sum - Easy DP with examples, published 2022-10-03
- Minimum Time to Make Rope Colorful - Easy approach O(N) solution based on RLE, published 2022-10-03
- Decode Ways - DP Easy Way, published 2022-10-01
- Two Sum II - Input Array Is Sorted - Three solutions, published 2022-09-27
- Swap Nodes in Pairs - Recursion, published 2022-09-27
- Push Dominoes - Nearest domino on each side, published 2022-09-27
- Count Sub Islands - DFS solution, published 2022-09-27
- 3Sum - Two pointers + Hashmap, published 2022-09-27
- 3Sum Closest - Two pointers in sorted array, published 2022-09-27
- Validate Binary Search Tree - Iterative InOrder C++, published 2022-08-11
- Partition List - Easy One pass O(1) space solution, published 2022-07-22
- Non-overlapping Intervals - Greedy cpp+python, published 2022-06-17
- Longest String Chain - Very Easy Hashmap solution + Analysis, published 2022-06-15
- All Paths From Source to Target - Easy DFS solution, published 2022-06-15
- Delete Operation for Two Strings - Edit Distance + LCS DP solutions, published 2022-06-14
- Next Greater Element II - NGE using stack on repeated array, published 2022-06-04
- Network Delay Time - Dijkstra method, published 2022-05-15
- Deepest Leaves Sum - Easy DFS solution, published 2022-05-15
- Populating Next Right Pointers in Each Node II - Connections using Level Wise Traversal DFS, published 2022-05-13
- Binary Tree Level Order Traversal - Three methods - Two DFS + One BFS, published 2022-05-13
- Count Sorted Vowel Strings - DP solution, published 2022-05-12
- Linked List Cycle II - Floyd's Tortoise and Hare Algorithm, published 2022-05-10
- Combination Sum III - DFS and All combinations, published 2022-05-10
- 132 Pattern - O(N^3), O(N^2), O(N log N) and O(N) solutions, published 2022-05-10
- Letter Combinations of a Phone Number - Iterative solution, published 2022-05-09
- Remove All Adjacent Duplicates in String II - Solution using stack, published 2022-05-06
- Max Number of K-Sum Pairs - Two Sum Approach, published 2022-05-04
- Smallest String With Swaps - DFS solution, published 2022-04-27
- Encode and Decode TinyURL - Easy HashMap solution, published 2022-04-23
- 3Sum With Multiplicity - 3 Sum over keys, published 2022-04-23
- Game of Life - O(1) space solution, published 2022-04-20
- Binary Search Tree Iterator - Two solutions: Easy and Medium, published 2022-04-20
- Spiral Matrix II - Two approaches, published 2022-04-19
- Convert BST to Greater Tree - Easy HashMap solution, published 2022-04-16
- Binary Search Tree to Greater Sum Tree - Easy HashMap solution, published 2022-04-16
- Trim a Binary Search Tree - Recursive C++ solution, published 2022-04-15
- Top K Frequent Words - 3 line simplest O(n log n ) solution by sorting, published 2022-03-27
- Number of Steps to Reduce a Number in Binary Representation to One - Simply simulate the steps, published 2022-03-27
- Delete and Earn - House Robber, published 2022-03-05
- Arithmetic Slices - Faster than 100% C++ solutions and also very easy to understand, published 2022-03-03
- Subsets - Simple Iterative solution, published 2022-02-13
- Check If a String Contains All Binary Codes of Size K - HashSet 2 solutions O(n) and O(nk), published 2022-02-13
- Subarray Sum Equals K - O(N) HashMap cummulative sum, published 2022-02-11
- Permutation in String - Sliding window, published 2022-02-11
- Valid Triangle Number - O(N^2) log(N) Binary Search [AC], published 2022-02-09
- Minimum Falling Path Sum - DP Solution very straightforward | Seam Carving, published 2022-02-06
- Contiguous Array - Well-explained HashMap concise with pseudocode, published 2022-02-04
- Seat Reservation Manager - Easy min-heap solution, published 2022-02-03
- Max Area of Island - DFS solution, published 2022-02-03
- 4Sum - C++ TLE vs Python AC issue, published 2022-02-03
- 4Sum II - Easy O(N^2) solution using HashMap, published 2022-02-03
- Find All Anagrams in a String - Simplest solution ever, published 2022-02-02
- Next Permutation - Well-explained O(n) easy to understand in C++, published 2022-02-01
- N-ary Tree Level Order Traversal - Easy BFS solution, published 2022-01-19
- Linked List Cycle II - An easy and a difficult solution, published 2022-01-19
- House Robber III - Recursion+Memoization [cpp] Explained with intuitions step-wise, published 2022-01-07
- Construct Binary Tree from Preorder and Inorder Traversal - Two easy to understand recursive solutions, published 2022-01-06
- Find All Possible Recipes from Given Supplies - Two ways to do topological sort, published 2021-12-29
- Check if a Parentheses String Can Be Valid - Greedy Solution with easy to understand intuition [C++,Python], published 2021-12-29
- Robot Bounded In Circle - C++ Basic solution, published 2021-12-10
- Gray Code - Python easy to understand 3 line recursive solution, published 2021-07-06