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 →
C++ Programs
155 postsGiven 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 →
Given two arrays of element between 0 to N- 1 of length N. Find the lexicographically smallest array c such that for any index i c[i] = ( a[i] + b[i])%N. To 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 →
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 →
Given 2 sorted arrays A and B of size N each. Print the sum of the middle elements of the array obtained after merging the given arrays. Examples: Input: arr1: 1 2 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 →
Given an array arr[] of n positive integers and q queries, in which each query have an integer k. For each query, the task is to output the minimum size of subarray Read more →
Given a sorted rotated array, the task is to find index of minimum element of the array. Following solution assumes that all elements are distinct. Examples: Input : arr[] = {5, 6, Read more →