# Category Archives: Divide and Conquer

Question: Write a function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically, we need… Read More
Question: Write a function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically, we need… Read More
Insertion sort: The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the… Read More
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the… Read More
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the… Read More
Order-Agnostic Binary Search is a modified version of Binary Search algorithm. Here in this modified binary search comes with one more condition checking. The intuition… Read More
Given two sorted arrays A[] and B[] consisting of N and M integers respectively, the task is to find the Kth smallest number in the… Read More
Given two numeric strings A and B, the task is to find the product of the two numeric strings efficiently. Example: Input: A = 5678,… Read More
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the… Read More
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