DATA STRUCTURE


Maximum Product Subset Problem

Maximum Product Subset Problem

Problem Given array a, we have to find the maximum product possible with the subset of elements …

Reverse every consecutive m-elements of a subarray

Reverse every consecutive m-elements of a subarray

Problem Given an array, reverse every sub-array formed by consecutive m elements. Sample Inpu…

Find maximum sum path involving elements of given arrays

Find maximum sum path involving elements of given arrays

Problem Given two sorted arrays, where the arrays may share some elements. Find the largest sum …

Find the smallest window in an array sorting which will make the entire array sorted

Find the smallest window in an array sorting which will make the entire array sorted

Problem Given an integer array nums, identify one continuous subarray that, if just this subarra…

Sort an almost sorted array where only two elements are swapped

Sort an almost sorted array where only two elements are swapped

Problem How can an almost-sorted array with only two members swapped be effectively sorted? S…

Find the longest subsequence formed by consecutive integers

Find the longest subsequence formed by consecutive integers

Problem Given an array of integers, find the longest subsequence of consecutive integers. Sam…

Determine the index of an element that satisfies given constraints in an array

Determine the index of an element that satisfies given constraints in an array

Problem Given an array of integers, find an index before which all elements are smallest than it…

Find equilibrium index of the array

Find equilibrium index of the array

Problem Calculate the equilibrium index of an array of integers. The equilibrium is the index…

Shuffle an array according to the given order of elements

Shuffle an array according to the given order of elements

Problem Given two integer arrays of the same size, arr[] and index[], reorder elements in arr[] …

Find duplicates within a range k in an array

Find duplicates within a range k in an array

Problem You are given an array of integers and a number k. You need to check if duplicates exist…

Decode an array constructed from another array

Decode an array constructed from another array

Problem There is a hidden integer array arr that consists of n non-negative integers. It was enc…

Find minimum sum of a subarray of size k

Find minimum sum of a subarray of size k

Problem Given an array of integers and a number k, find the minimum sum of a subarray of size k.…