Difference between highest and least frequencies in an array

The problem “Difference between highest and least frequencies in an array” states that suppose that you have an integer array. The problem statement asks to find out the maximum difference between the highest frequency and lowest frequency of two distinct numbers in an array. Example arr[] = {1, 2, 3, …

Read moreDifference between highest and least frequencies in an array

k-th missing element in increasing sequence which is not present in a given sequence

The problem “k-th missing element in increasing sequence which is not present in a given sequence” states that you are given two arrays. One of them is arranged in ascending order and another normal unsorted array with number k. Find the kth missing element which is not present in normal …

Read morek-th missing element in increasing sequence which is not present in a given sequence

Check in binary array the number represented by a subarray is odd or even

The problem “Check in binary array the number represented by a subarray is odd or even” states that you are given a binary array and a range. The array consists of the number in the form of 0s and 1s. The problem statement asks to find out the number represented …

Read moreCheck in binary array the number represented by a subarray is odd or even

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 moreThree way partitioning of an array around a given range

Count subarrays having total distinct elements same as original array

Problem Statement “Count subarrays having total distinct elements same as original array” states that you are given an integer array. The problem statement asks to find out the total number of sub-arrays that contain all distinct elements as present in an original array. Example arr[] = {2, 1, 3, 2, …

Read moreCount subarrays having total distinct elements same as original array

Collect maximum points in a grid using two traversals

Problem Statement We are given a matrix of size “n x m”, and we need to collect maximum points in a grid using two traversals. If we are standing at cell i,j then we have three options to go to cell i+1, j or i+1, j-1or i+1, j+1. That is …

Read moreCollect maximum points in a grid using two traversals

Find the smallest positive integer value that cannot be represented as sum of any subset of a given array

Problem Statement You are given a sorted array of integers. We need to find the smallest positive integer value that cannot be represented as sum of any subset of a given array. Example arr[] = {1,4,7,8,10} 2 Explanation: Because there is not any sub-array that can represent 2 as a …

Read moreFind the smallest positive integer value that cannot be represented as sum of any subset of a given array