Skip to content

Category Archives: Algorithms

Given a binary matrix mat[][] of dimensions M*N, the task is to check whether there exist T continuous blocks of 0s or not and at… Read More
Given an array arr[] of N distinct integer, the task is to find the minimum number of jumps required from the largest element to reach… Read More
Given a sorted array arr[] consisting of N integers, the task is to find the maximum among the count of positive or negative integers in… Read More
Given two integers A and B, the task is to find the minimum possible size of the array whose MEX of the array is A… Read More
Given two permutations arrays arr[] and brr[] of the first N Natural Numbers from 1 to N, the task is to find the absolute difference… Read More
Given a positive integer N, the task is to find the number of triplets (A, B, C) from the first N Natural Numbers such that… Read More
Given N points on a plane, where each point has a direct path connecting it to a different point, the task is to count the… Read More
Given a positive integer N, the task is to find the largest number in the range [1, N] such that the square root of the… Read More
Given four arrays x1[], x2[], y1[], y2[] of size N where (x1[i], y1[i]) denotes the left-bottom corner and (x2[i], y2[i]) right-top corner of a rectangle,… Read More
Given a queue consisting of the first N natural numbers and queries Query[][] of the type {E, X}, the task is to perform the given… Read More
Given an undirected, connected tree with N nodes valued from 0 to N – 1 and an array edges[][2] represents the edges between two nodes,… Read More
Given an array arr[] of size N, the task is to find 4 indices i, j, k, l such that 0 <= i, j, k,… Read More
Given an array arr[] of size N. The task is to find the minimum number of swaps required to re-arrange the array such that all… Read More
Given the root node of an N-ary tree and an integer K, the task is to convert the given tree into adjacency list representation and… Read More
Given a string S of N characters, the task is to calculate the total number of non-empty substrings such that at most one character occurs… Read More