Given an array of size N, print the index of the distinct element from the array, provided the array has only one distinct element and rest other elements are same. Examples: Input: Read more →
Arrays
106 postsThe min-product of an array is equal to the minimum value in the array multiplied by the array’s sum. For example, the array [3,2,5] (minimum value is 2) has a min-product of Read more →
Given an array of distinct positive integers arr[] of length N, the task is to count all the number of pairs of indices (i , j) such that a[j]−a[i] = j−i given Read more →
Given an integer array nums, return the sum of floor(nums[i] / nums[j]) for all pairs of indices 0 <= i, j < nums.length in the array. The floor() function returns the integer Read more →
In a country some special kinds of coins are available. The coin’s value is decided by a rule, that the values of the coins are first N positive odd numbers. As an Read more →
Mithlesh has ‘N’ buckets each consisting of some fruits. Mithlesh wants to eat at least ‘M’ fruits and so, he decided to set a marker (integer) as maximum as possible such that Read more →
Given a vector vec, and a integer K the task is to count the number of elements such that it occurs only once in the vector and with the number Kth times Read more →
Given two arrays a and b of the same size. Find the count of total pair in array a, such that the sum of elements of pair of array a is greater Read more →
Given an array consisting of integers in range 1 to n consisting of only one duplicate element. Find out the duplicate element in O(logN) time. Examples: Input : 6 1 1 2 Read more →
Given a zero-indexed array P containing N integers (a permutation of number from 1 to N), where P[i] denotes the number of the rose which will start blooming on day number i+1, Read more →