## Check if a given array contains duplicate elements within k distance from each other

The problem “Check if a given array contains duplicate elements within k distance from each other” states that we have to check for duplicates in given unordered array within the range of k. Here the value of k is smaller than the given array. Examples K = 3   arr[] = …

## Maximum product of an increasing subsequence

Problem Statement The problem “Maximum product of an increasing subsequence” states that you are given an array of integers. Now you need to find out the maximum product you can achieve such that you multiply the elements of an increasing subsequence. The thing to note is that, we are not …

## Print modified array after executing the commands of addition and subtraction

You are given an array of size n, initially all the values in the array will be 0, and the queries. Each query contains the four values, type of the query T, left point of the range, the right point of a range and a number k, you have to …

## Newman–Shanks–Williams prime

Problem Statement A Newman–Shanks–Williams prime (NSW prime) is nothing but a prime number which can be represented in a specific form given the following formula: So we need to find nth NSW prime. Example n = 3 7 Explanation S0 = 1, S1 = 1, S2 = 2*S1 + S0 …

## Binomial Coefficient

Problem Statement Find the Binomial Coefficient for a given value of n and k. “In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers n ≥ k ≥ 0 and is written as ” – quoted from Wikipedia. Example n = 5, k …

## Count subarrays where second highest lie before highest

Problem Statement The problem “Count subarrays where second highest lie before highest” states that you are given an array a[ ] of size n where n is greater than or equal to 2. Count the total number of subarrays in which the index of highest element of the subarray is …

Translate »