Skip to content

Category Archives: Divide and Conquer

Introsort(Introspective sort) is a comparison based sort that consists of three sorting phases. They are Quicksort, Heapsort, and Insertion sort. Basic concepts of Introsort and… Read More
Given an integer N. The following tasks are performed:   The number is noted. The leading digit from N is subtracted from N and the resulting… Read More
Given two integers A and B, the task is to calculate 22A % B. Examples:   Input: A = 3, B = 5 Output: 1 223 % 5… Read More
Given three integers X, N and M. The task is to find XXX…(N times) % M where X can be any digit from the range… Read More
Given string str. You are allowed to delete only some contiguous characters if all the characters are the same in a single operation. The task… Read More
Given a range [L, R], the task is to find the sum i * countDigits(i)2 for all i ∈ [L, R] where countDigits(i) is the… Read More
Given a spirally sorted matrix with N × N elements and an integer X, the task is to find the position of this given integer… Read More
Given k sorted arrays of different length, merge them into a single array such that the merged array is also sorted.Examples:  Input : {{3, 13},… Read More
Given a range [L, R] where L ≤ R, the task is to generate a random permutation of the sequence [L, L + 1, L… Read More
Giving k sorted arrays, each of size N, the task is to merge them into a single sorted array. Examples:  Input: arr[][] = {{5, 7,… Read More
Given N vertex where N is even. Initially there is no edge between any of the vertices. You are allowed to perform operation as illustrated here:  … Read More
Given a number X, the task is to find the minimum number N such that the total set bits of all numbers from 1 to… Read More
Given a string S containing lowercase latin letters. A character c is called K-amazing if every substring of S with length atleast K contains this… Read More
Given an array of N integers where array elements form a strictly decreasing and increasing sequence. The task is to find the smallest number in… Read More
Given an array arr[] of N integers and number of queries Q. The task is to answer three types of queries. Update [l, r] –… Read More

Start Your Coding Journey Now!