Apr 9 · 2 min read · Medium — Graph | Depth-First Search | Matrix | Connected Components The Problem Given a 2D grid map of '1's (land) and '0's (water), count the number of islands where an island is surrounded by water and formed by connecting adjacent lands horizontal...
Join discussionApr 9 · 1 min read · Medium — Graph | Depth-First Search | Union Find | Connected Components The Problem Given n nodes labeled from 0 to n-1 and a list of undirected edges, return the number of connected components in the graph. Approach Build an adjacency list represent...
Join discussionApr 9 · 1 min read · Easy — Bit Manipulation | Math The Problem Given a positive integer n, count and return the number of set bits (1s) in its binary representation. Approach Use bit manipulation to check each bit position by performing bitwise AND with 1 to detect if t...
Join discussionApr 9 · 1 min read · Medium — Greedy | Sorting | Intervals | Array The Problem Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Approach Sort intervals by their end times, then gre...
Join discussionApr 9 · 1 min read · Easy — Array | Bit Manipulation | Math The Problem Given an array nums containing n distinct numbers in the range [0, n], find the one number that is missing from this range. Approach Use XOR properties where a ^ a = 0 and a ^ 0 = a. Initialize with ...
Join discussionApr 9 · 2 min read · Hard — Sliding Window | Two Pointers | Hash Table | String The Problem Find the minimum window substring in string s that contains all characters of string t. If no such window exists, return an empty string. Approach Use a sliding window technique w...
Join discussionApr 9 · 1 min read · Medium — Heap | Sorting | Array | Greedy The Problem Given a list of intervals and queries, find the minimum length interval that contains each query point, returning -1 if no interval contains the query. Approach Sort intervals by start time and que...
Join discussionApr 9 · 1 min read · Medium — Stack | Design | Data Structure The Problem Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. All operations must be performed in O(1) time complexity. Approach Use two stacks - one main stack ...
Join discussionApr 9 · 2 min read · Medium — Graph | Union Find | Minimum Spanning Tree | Greedy The Problem Find the minimum cost to connect all points in a 2D plane where the cost between any two points is the Manhattan distance (sum of absolute differences of coordinates). Approach ...
Join discussion