Skip to content

Category Archives: Divide and Conquer

Given m roads and n cars. The cars are numbered from 1 to n. You are also given an array arr[] of size m, each… Read More
Method 1 (Using Nested Loops):We can calculate power by using repeated addition. For example to calculate 5^6. 1) First 5 times add 5, we get 25. (5^2) 2)… Read More
Problem: Given a sorted array arr[] of n elements, write a function to search a given element x in arr[] and return the index of… Read More
Greedy Algorithm: Greedy algorithm is defined as a method for solving optimization problems by taking decisions that result in the most evident and immediate benefit… Read More
Divide and conquer Algorithm: Divide and Conquer is an algorithmic paradigm in which the problem is solved using the Divide, Conquer, and Combine strategy. A… Read More
Given a number n, find the cube root of n.Examples:  Input: n = 3 Output: Cubic Root is 1.442250 Input: n = 8 Output: Cubic… Read More
Given an integer X, find its square root. If X is not a perfect square, then return floor(√x). Examples :  Input: x = 4Output: 2Explanation:… Read More
Given a perfect binary tree of height N  and an array of length 2N which represents the values of leaf nodes from left to right.… Read More
Given an array arr[] consisting of N elements(such that N = 2k for some k ≥ 0), the task is to reduce the array and… Read More
Representation Change is one of the variants of the Transfer and Conquer technique where the given problem is transformed into another domain that is more… Read More
Given four arrays A[], B[], C[], D[] and an integer K. The task is to find the number of combinations of four unique indices p,… Read More
Given an array arr[]. The task is to divide arr[] into the maximum number of partitions, such that, those partitions if sorted individually make the… Read More
Given a linked list lis of length N, where N is even. The task is to maximize the sum of two equidistant nodes from the… Read More
Given an array arr[], and an integer N. The task is to maximize the sum of minimum and maximum of each group in a distribution… Read More
Given an ascending sorted array arr[] of size N and an integer K, the task is to partition the given array into K non-empty subarrays… Read More

Start Your Coding Journey Now!