##
Count ways to form minimum product triplets
November 1, 2017

Given an array of positive integers. We need to find how many triples of indices (i, j, k) (i < j < k), such that… Read More »

November 1, 2017

Given an array of positive integers. We need to find how many triples of indices (i, j, k) (i < j < k), such that… Read More »

October 31, 2017

There are given an array of natural numbers and another array with corresponding weight of the number. Then we have to calculate the weighted mean.… Read More »

Given an array and a number k, find a subsequence such that Sum of elements in subsequence is maximum Indices of elements of subsequence differ… Read More »

October 30, 2017

Given an array of n positive integers such that each element of integer is from 1 to n. Find the lexicographically permutation that can be… Read More »

Given an array of size n. The task is to find the longest subsequence such that difference between adjacents is one. Time Complexity of O(n)… Read More »

October 29, 2017

Given an array of n integers and q queries, print the number of next greater elements to the right of the given index element. Examples:… Read More »

Given any sequence , find the largest derangement of . A derangement is any permutation of , such that no two elements at the same… Read More »

October 28, 2017

Given an array of size n containing 0’s and 1’s only. The problem is to find the length of the longest subarray having count of… Read More »

Given n integers, which form a circle. Find the minimal absolute value of any adjacent pair. If there are many optimum solutions, output any of… Read More »

Given an array of size n containing equal number of odd and even numbers. The problem is to arrange the numbers in such a way… Read More »

In C++, we can quickly find array sum using accumulate() Output: 30 Sum of vector Output: 30 We can also use a custom function in… Read More »

Given an encoding of a binary string of length k, the task is to find if the given encoding uniquely identifies a binary string or… Read More »

Given an unsorted array of n integers which can contains n integers. Count frequency of all elements that are present in array. Examples: Input :… Read More »

October 27, 2017

Given an array a[] and an element x, find number of occurrences of x in a[]. Examples: Input : a[] = {0, 5, 5, 5,… Read More »

Given an array of positive and negative numbers, arrange them such that all negative integers appear before all the positive integers in the array. The… Read More »