Dec 28, 2025
You are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are generated such that you...
leetcodemediumdijkstrashortest-pathgraphdynamic-programming
Dec 18, 2025
There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city...
leetcodealgorithmmediumjavadisjoint-setdfsgraphproblem-solving
Dec 17, 2025
You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi =...
leetcodealgorithmmediumjavadisjoint-setgraphdfsproblem-solving
Dec 16, 2025
You have a data structure of employee information, including the employee’s unique ID, importance value, and direct subordinates’ IDs.
leetcodealgorithmmediumjavadfsbfshash-tableproblem-solving
Dec 16, 2025
You are given a 2D array of axis-aligned rectangles. For each rectangle[i] = [xi1, yi1, xi2, yi2], where (xi1, yi1) is the bottom-left corner and (xi2, yi2) is the top-right...
leetcodealgorithmhardjavageometrysweep-linesegment-treeproblem-solving
Dec 14, 2025
You are given an m x n grid rooms initialized with these three possible values:
leetcodealgorithmmediumjavaarraymatrixbfsproblem-solving
Dec 14, 2025
Given an integer n, return the least number of perfect square numbers that sum to n.
leetcodealgorithmmediumjavamathdynamic-programmingbfsproblem-solving
Dec 14, 2025
Greedy algorithms are among the most elegant tools in competitive programming — when they work, they’re simpler and faster than dynamic programming. This guide covers the core greedy patterns you’ll...
leetcodetemplatesgreedy
Dec 14, 2025
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.
leetcodealgorithmeasyjavaqueuesliding-windowdesignproblem-solving
Dec 13, 2025
You are given an m x n grid where each cell can have one of three values:
leetcodealgorithmmediumjavaarraymatrixbfsproblem-solving