2192. All Ancestors of a Node in a Directed Acyclic Graph
You are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n – […]
You are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n – […]
You are given an integer n denoting the number of cities in a country. The cities are numbered from 0 to n – 1. You
Given a two-dimensional integer array arr of dimensions n x n, consisting solely of zeros and ones, identify the row or column (using
There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n –
A Toeplitz (or diagonal-constant) matrix is a matrix in which each descending diagonal from left to right is constant, i.e.,
Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example
Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is included in the window. If there is no
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the
Given the root of a binary search tree, return a balanced binary search tree with the same node values. If there is more than one
Given a binary matrix having n rows and m columns, your task is to find the sum of coverage of all zeros in the matrix where coverage for
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many
Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space