## Find Largest d in Array such that a + b + c = d

Problem Statement   Suppose you have an array of integers. Input values are all distinct elements. The problem “Find largest d in array such that a + b + c = d” asks to find out the largest element ‘d’ in the set such that a + b + c = …

## 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 …

## Given an Array of Pairs Find all Symmetric Pairs in it

Find all symmetric pairs – You are given some pairs of an array. You have to find out the symmetric pairs in it. The symmetric pair is said to be symmetric when in pairs say (a, b) and (c, d) in which ‘b’ is equal to ‘c’ and ‘a’ is …

## 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[] = …

## Print all subarrays with 0 sum

You are given an integer array, your task is to print all the possible sub-arrays with sum is equal to 0. So we need to Print all subarrays with 0 sum. Example   arr[] = {-2, 4, -2, -1, 1, -3, 1, 5, 7, -11, -6} Sub-Array found from 0 index …

## 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” …

## 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 …

## 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 …

## Print modified array after multiple array range increment operations

The problem “Print modified array after multiple array range increment operations” states that you are given an integer array and ‘q’ numbers of queries are given. One integer value “d” is also given. Each query contains two integers, starting value and an ending value. The problem statement asks to find …

## Find all pairs (a, b) in an array such that a % b = k

Problem Statement   The problem “Find all pairs (a, b) in an array such that a % b = k” states that you are given an array of integers and an integer value called k. The problem statement asks to find out the pair in such a way that that x …