Mar 18, 2026
Given a binary tree, a node X is good if there is no node with a value greater than X on the path from root to X. Return the number...
leetcodemediumtreedfsbfs
Mar 17, 2026
A company has n employees numbered 0 to n-1. Each employee has exactly one direct manager given in manager[i], except the head of the company (manager[headID] == -1). An employee...
leetcodemediumtreedfsbfs
Mar 16, 2026
You are given a 2D array intervals where intervals[i] = [left_i, right_i] represents the inclusive interval [left_i, right_i]. Divide the intervals into one or more groups such that no two...
leetcodemediumgreedyheapintervals
Mar 15, 2026
A gene string is represented by an 8-character string of 'A', 'C', 'G', and 'T'. Given startGene, endGene, and a bank of valid gene strings, return the minimum number of...
leetcodemediumbfsstring
Mar 12, 2026
There are n rooms labeled 0 to n-1. All rooms are locked except room 0. Each room contains a set of keys to other rooms. Given rooms[i] – the set...
leetcodemediumgraphdfsbfs
Mar 11, 2026
Given an n x n binary matrix grid, return the length of the shortest clear path from top-left (0,0) to bottom-right (n-1,n-1). A clear path consists of cells with value...
leetcodemediumgraphbfs
Mar 10, 2026
There are n computers numbered 0 to n-1 connected by cables. connections[i] = [a, b] means a cable connects computers a and b. You can remove an existing cable and...
leetcodemediumgraphdsu
Mar 10, 2026
Given the head of a singly linked list, return the middle node. If there are two middle nodes, return the second middle node.
leetcodeeasylinked-listtwo-pointers
Mar 9, 2026
You are given a string s and an array of index pairs pairs where pairs[i] = [a, b] indicates you can swap the characters at indices a and b any...
leetcodemediumstringgraphdsu
Mar 8, 2026
You are given an array points where points[i] = [xi, yi] represents a point on the 2D plane. The cost to connect two points is the Manhattan distance: |xi -...
leetcodemediumgraphmstdsu