Skip to content

Category Archives: Divide and Conquer

Given a Generic Tree consisting of N nodes numbered from 0 to N – 1 which is rooted at node 0 and an array val[]… Read More
Given an array arr[] of N distinct integers, the task is to check if it is possible to sort the array in increasing order by… Read More
Given three integers A, N and P, the task is to find (A^(N!)) % P. Examples: Input: A = 2, N = 1, P =… Read More
Given a binary string s, the task is to calculate the number of such substrings where the count of 1‘s is strictly greater than the… Read More
There are many ways of classifying algorithms and a few of them are shown below: Implementation Method Design Method Other Classifications Classification by Implementation Method:… Read More
Given three numbers W, B, and O representing the quantities of white, black, and other colors shirts respectively, the task is to find the maximum… Read More
Given two integers W and C, representing the number of watermelons and coins, the task is to find the maximum number of mangoes that can… Read More
Given a sorted array arr[] of size N and an integer K, the task is to find Kth smallest element present in the array. The… Read More
Given an array arr[] consisting of N integers, the task is to sort the given array in ascending order using the slow sort. Examples: Input:… Read More
Competitive Programming is vital for one’s development in the coding field. This article is going to discuss some basics points one should keep in mind… Read More
Given an array arr[] consisting of N integers, the task is to count the number of greater elements on the right side of each array… Read More
Given an array arr[] consisting of 2* N elements in the form of { a1, a2, …, aN, b1, b2, …, bN }, the task… Read More
Given a mountain array arr[] and an integer X, the task is to find the smallest index of X in the given array. If no… Read More
Given an array arr[] of size N, the task is to find the minimum count of array elements found by applying the Randomized Binary Search… Read More
Given two positive integers N and X, the task is to find the smallest divisor of N which is closest to X. Examples: Input: N… Read More