Given a binary matrix mat[][] of dimensions N*M, the task is to find the minimum number of flips required from the given binary matrix such… Read More

# Category Archives: Graph

Given a matrix of dimensions N*M consisting of characters ‘M’, ‘#’, ‘.’ and only a single instance of ‘A’. The task is to print any… Read More

Independent set of Graph as a pre-requisite is the set of vertices where no two are adjacent to each other. It is just opposite in… Read More

Given an unweighted and undirected graph consisting of N nodes and two integers a and b. The edge between any two nodes exists only if… Read More

Given a graph, G consisting of N nodes, a source S, and an array Edges[][2] of type {u, v} that denotes that there is an… Read More

Given an array arr[](1-based indexing) consisting of N positive integers such that arr[i] denotes the amount of the ith person. Also given are two 2D… Read More

Given a Directed Acyclic Graph with V vertices and E edges, the task is to find the set of dominant vertices for each vertex of… Read More

Given an undirected Graph consisting of N nodes in the form of an adjacency matrix graph[][] of size N*N, the task is to print all… Read More

Given a positive integer N, the task is to find the number of unique permutations of first N natural numbers having sum of the adjacent… Read More

Given an array arr[] consisting of N strings representing the name of the students in the class and another array of pairs P[][2] such that… Read More

Given an unweighted graph and a boolean array A[ ], where if the ith index of array A[ ] denotes if that node can can… Read More

Given a matrix mat][][] of size M x N which represents the topographic map of a region, and 0 denotes land and 1 denotes elevation,… Read More

Given an undirected graph consisting of N vertices and M edges and an array edges[][], with each row representing two vertices connected by an edge,… Read More

Data structures are divided into two categories Linear data structures and Non-Linear data structures. The major disadvantage of the linear data structure is we cannot… Read More

Given N nodes valued by [1, N], an array arr[] consisting of N positive integers such that the ith node ( 1-based indexing ) has… Read More