Find subarray with given sum (Handles Negative Numbers)

The problem “Find subarray with given sum (Handles Negative Numbers)” states that you are given an integer array, containing negative integers as well and a number called “sum”. The problem statement asks to print the sub-array, which sums up to a given number called “sum”.  If more than one sub-array …

Read more

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 …

Read more

Range sum queries without updates

Problem Statement   The problem “Range sum queries without updates” states that you have an array of integers and a range. The problem statement asks to find out the sum of all the elements within the given range. Example   arr[]={10, 9, 8, 7, 6} Query: {(0, 4), (1, 3)} 40 24 …

Read more

Three way partitioning of an array around a given range

Problem Statement   You are given an array of integers and a range of lowValue and highValue. The problem “Three way partitioning of an array around a given range” asks to partition the array such that array will be divided into three parts. The partitions of the arrays will be: Elements …

Read more

Count quadruples from four sorted arrays whose sum is equal to a given value x

Problem Statement   Problem “Count quadruples from four sorted arrays whose sum is equal to a given value x” state that you are given four integer arrays and a value called x. The problem statement asks to find out how many quadruplets can be formed of which sum of elements of …

Read more