Tag Archives: arrays

Find minimum number of merge operations to make an array palindrome

Find minimum number of merge operations to make an array palindrome In this post we try to convert a given array into a palindrome by using minimum number of merge operations. Find minimum number of merge operations to make an array palindrome Given an array of positive integers. We need to make the given array… Read More »

Construct an array from it’s pair sum array

Construct an array from it’s pair sum array In this post we deal with the problem of constructing the original array from the array in which the sum of all pairs that can be made from the input array are given. Construct an array from it’s pair sum array Problem Statement: Given a pair-sum array… Read More »

Find number of pairs(x,y) in an array such that x^y > y^x

Find number of pairs(x,y) in an array such that xy > yx In this post we find solution to the problem of finding number of pairs in the given array such that they satisfy the condition that xy > yx. Find number of pairs(x,y) in an array such that xy > yx Problem Statement : Given… Read More »

Delete an Array Element(using one and two traversals)

Delete an Array Element In this post we deal with the common problem of deleting an element fro the array using not only two but one traversal too. Delete an Array Element Problem Statement: Given an array of n integers ,we need to delete a given element of the array. We can delete an array… Read More »

Print All Distinct Elements of the given Array

Print All Distinct Elements of the given Array In this post we deal with the problem of finding all the elements in the array which are not repetitive,that is they appear only once and printing them. Print All Distinct Elements of the given Array Problem Statement: Given an integer array, we need to print all… Read More »

Smallest Subarray with sum greater than a given value

Smallest Subarray with sum greater than a given value In this post we deal with the problem of finding the smallest subarray with sum greater than a given value from the given input array. Smallest Subarray with sum greater than  a given value Problem Statement: Given an array of n integers and a value ‘x’… Read More »

Sort an Array in Wave Form

Sort an Array in Wave Form In this post we learn how to sort an array in a wave like array ,namely  a1>=a2<=a3>=a4 and so on. How to Sort an Array in Wave Form Problem Statement: Given an unsorted array of integers, we need to sort the array into a wave like array. An array… Read More »

Find Pythagorean Triplet in an Array

Find Pythagorean Triplet in an Array In this post we deal with the problem of finding a pythagorean triplet in the given array. How to Find Pythagorean Triplet in an Array Problem Statement: Given an array of n integers , we need to write a function that returns true if any  elements of the array… Read More »

Maximum Product Subarray

Maximum Product Subarray In this post we deal with the problem of finding a maximum product subarray from the given input array. Finding Maximum Product Subarray Problem Statement Given an input array which is allowed to contain both positive and negative integers, we need to find the subarray that has the maximum product from the… Read More »

Find a pair with the given difference in an array

Find a pair with the given difference in an array In this post we deal with the question on how to find a pair with the given difference in an array. Find a pair with the given difference in an array Problem Statement: Given an unsorted array and a number n,we need to find if… Read More »