## Maximum possible difference of two subsets of an array

Suppose, we have an integer array. The problem statement “Maximum possible difference of two subsets of an array” asks to find out the maximum possible difference between the two subsets of an array. Conditions to be followed: An array can contain repeating elements, but the highest frequency of an element …

## Path with maximum average value

Problem Statement The problem “Path with maximum average value” states that you are given a 2D array or a matrix of integers. Now consider you are standing at the top-left cell and need to reach the bottom right. For reaching the destination, you need to move along either in the …

## Count Substrings with equal number of 0s, 1s and 2s

The problem “Count Substrings with equal number of 0s, 1s and 2s” states that you are given a string that has 0, 1, and 2 only. The problem statement asks to find out the number of substrings that contain equal no of 0, 1, and 2 only. Example str= “01200” …

## Moser-de Bruijn Sequence

In this problem, you are given an integer input n. Now you need to print the first n elements of the Moser-de Bruijn Sequence. Example 7 0, 1, 4, 5, 16, 17, 20 Explanation The output sequence has the first seven elements of the Moser-de Bruijn Sequence. Thus the output …

## Golomb sequence

Problem Statement The problem “Golomb sequence” states that you are given an input integer n and you need to find all the elements of Golomb sequence until nth element. Example n = 8 1 2 2 3 3 4 4 4 Explanation The first 8 terms of the Golomb sequence …

## Largest subarray with equal number of 0s and 1s

You are given an array of integers. The integers are only 0 and 1 in the input array. The problem statement asks to find out the largest sub-array that can have equal count of 0s and 1s. Example arr[]={0,1,0,1,0,1,1,1} 0 to 5 (total 6 elements) Explanation From the array position …

## Queries for counts of array elements with values in given range

Problem Statement The problem “Queries for counts of array elements with values in given range” states that you have an integer array and two number x and y. The problem statement asks to find out the count of numbers present in array that lies between the given x and y. …

## GCDs of given index ranges in an array

Problem Statement The problem ‘GCDs of given index ranges in an array” states that you are given an integer array and some range queries. The problem statement asks to find out the Greatest Common Divisor of the sub-array so formed within the range. Example arr[] = {10, 5, 18, 9, …

## Mean of range in array

Problem Statement The problem “Mean of range in array” states that you are given an integer array and q number of queries. Each query contains the left and right as a range. The problem statement asks to find out the floor mean value of all the integers that come in …

## Products of ranges in an array

Problem Statement The problem “Products of ranges in an array” states that you are given an integer array consisting of numbers range from 1 to n and q number of queries. Each query contains the range. The problem statement asks to find out the product within the given range under …

Translate »