Skip to content

Tag Archives: disjoint-set

Given two integers N and M which denote the size of a matrix where initially all the cells are 0s. There are also K queries… Read More
Given an undirected graph of N node, where nodes are numbed from 1 to N, and an array of edges, where edges[i] = {edgeType, u,… Read More
Given a 2D array arr[] and value K, where each list in arr[] represents a point on Cartesian coordinates, the task is to group the… Read More
Given two strings str1 and str2 containing lowercase letters. The task is to convert the given string str3 into lexicographically smallest and largest string that… Read More
Given N vertices numbered from 0 to N – 1 and E edges to form an undirected graph. All the edges should be added in… Read More
Given a group of N people, each having a unique ID value from 0 to (N – 1) and an array arr[] of M elements… Read More
Given an array arr[] of N strings consisting of lowercase alphabets, the task is to find the number of distinct groups of strings formed after… Read More
Given a disconnected graph G with N vertices and M edges and an array cost[] corresponding to each vertex, the task is to find the… Read More
Given a positive integer N representing the set of integers [1, N] and an array queries[] of length Q of type {L, K}, the task… Read More
Given an array of pairs arr[][] of length N, and an array queries[] of length M, and an integer R, where queries[i] contain an integer… Read More
Given two arrays arr[](1-based indexing) and queries[] consisting of N integers and queries[] contains a permutation of the first N natural numbers, the task is… Read More
Given an undirected graph G(V, E)  consisting of2 N vertices and M edges, the task is to find the smallest vertex in the connected component… Read More
Given an array of pairs arr[][] of length N, and an array queries[] of length M, and an integer R, where each query contains 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 an undirected graph G with vertices numbered in the range [0, N] and an array Edges[][] consisting of M edges, the task is to… Read More

Start Your Coding Journey Now!