Given a positive number N denoting the number of People, an array ‘Heights‘ which contains the heights of N persons standing in a queue, and an array ‘Infronts‘ whose each entry gives Read more →
Algorithms
6 postsGiven numbers from 1 to 10^10, we need to select that maximum number i from the range such that A*b(i)+C*i does not exceed m. A and C will be given and b(i) means Read more →
One combination of made up of N different things. You are given an array of length N which indicate the amount of N different things which one combination contain. You are given Read more →
Given an array arr[] of size N, find the length of its longest subarray such that the sum of its elements not divisible by K, or determine that such subarray does not 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 →
Find the minimum number ‘N’ such that the sum of ‘N’ natural numbers is greater than or equal to a given number ‘NUM’ using Binary Search. In this problem, we need to Read more →
Recursion is a powerful way of developing algorithms in which the solution of a problem is determined by the solution of one or more identical subproblems. A recursive solution involves two parts: Read more →
We’re given a function in the format of f(x). We have to find the minimum absolute difference between f(x) and given number k over a range (0 – 10^6). This article assumes Read more →
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 →
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 →