Separate People Given Dislike Relations
You are given an integer n and a two-dimensional list of integers enemies. Integer n means there’s n people labeled from [0, n - 1]. Each element in enemies ...
You are given an integer n and a two-dimensional list of integers enemies. Integer n means there’s n people labeled from [0, n - 1]. Each element in enemies ...
You are given three lowercase alphabet strings a, b and target. Strings a and b have the same length and are defined to be equivalent: a[i] = b[i]. For examp...
Given a two-dimensional list of integers matrix containing 0s and 1s, 0 represents water and 1 represents land.
Given an undirected graph as an adjacency list, return whether the graph has an odd length cycle.
Given an undirected graph represented as an adjacency list, return whether the graph is bipartite.
You are given a two-dimensional list of integers ports where ports[i] represents the list of ports that port i is connected to. You are also given another tw...
Given an 2D matrix of 0s and 1s, a 1 represents land and 0 represents water. An island is a group of 1’s that are surrounded by 0s or by the border. Find all...
You are given a two dimensional array matrix, containing strings “r”, “g”, and “b”. Perform a floodfill operation at row r, column c with the color target.
You are given a two-dimensional list of integers edges representing a connected, directed, acyclic graph. Each element in edges contains [u, v] meaning there...
Given a two-dimensional integer matrix of 1s and 0s where 0 represents empty cell and 1 represents a block that forms a shape, return the perimeter of the sh...
Given a directed graph represented as an adjacency list, return its reverse so if an edge goes from A to B, it now goes from B to A.
Given a two-dimensional integer matrix of 1s and 0s, return the number of “islands” in the matrix. A 1 represents land and 0 represents water, so an island i...
You are given a two-dimensional integer matrix of 1s and 0s. A 1 represents land and 0 represents water, so an island is a group of 1s that are neighboring w...
You are given n people represented as an integer from 0 to n - 1, and a list of friends tuples, where person friends[i][0] and person friends[i][1] are frien...
You are given an undirected graph friends as an adjacency list, where friends[i] is a list of people i is friends with. Friendships are two-way. Two people a...
You are given a list of flights that were taken, represented as origin to destination airport pairs. Given that this list was shuffled, find all the airports...
You are given a two-dimensional list of integers relations. Each element relations[i] contains [a, b] meaning that person a is following person b on Twitter.