In a prison, there are N cells. The positions of the cells are given in an array. The Jailer has to place all the prisoners in the cells in an ordered manner Read more →
Divide and Conquer
6 postsGiven an integer k and array of length N find the min no of move to make all the elements divisible by k. In one move you can go one of the Read more →
You have to paint n boards of length {L1, L2, L3,…,Ln-1}. There are k painters available and each painter takes t time to paint 1 unit of board. You have to get Read more →
Prerequisite – What is Algorithm | Introduction to Algorithms Advantages of Divide and Conquer Solving difficult problems: Divide and conquer is an efficient method for solving difficult problems. For example, consider the Read more →
There is an array arr[] of length N. Your task is to find the sum of the minimum elements of each possible sub-array of the array. Examples: Input : arr[] = {2, Read more →
Write an efficient C program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum. Examples: Input : {-2, -3, 4, -1, -2, 1, Read more →