Minimum number of Merge Operations to make an Array Palindrome

Problem Statement In the “Minimum number of Merge Operations to make an Array Palindrome” problem we have given an array “a[]”. Find the minimum number of merge_operations are required to make an array palindrome. Note, A palindrome is a word, phrase, or sequence that reads the same backward as forwards. …

Read moreMinimum number of Merge Operations to make an Array Palindrome

Form Minimum Number from Given Sequence of D’s and I’s

Problem Statement In the “Form Minimum Number from Given Sequence of D’s and I’s” problem, we have given a pattern containing only I’s and D’s. I for increasing and D for decreasing. Write a program to print the minimum number following that pattern. Digits from 1-9 and digits can’t repeat. Input Format …

Read moreForm Minimum Number from Given Sequence of D’s and I’s

Find the Subarray of given length with Least Average

Problem Statement In the “Find the Subarray of given length with Least Average” problem we have given an array and an input integer X. Write a program to find the subarray of length X with least/minimum average. Prints the starting and ending indexes of the subarray which has the least …

Read moreFind the Subarray of given length with Least Average

Find Zeros to be Flipped so that Number of Consecutive 1’s is Maximized

Problem Statement In the “Find Zeros to be Flipped so that Number of Consecutive 1’s is Maximized” problem we have given a binary array and a number x which denotes the no. of zeros to be flipped. Write a program to find the zeros that need to be flipped so …

Read moreFind Zeros to be Flipped so that Number of Consecutive 1’s is Maximized

Find the Minimum Element in a Sorted and Rotated Array

Problem Statement In the “Find the Minimum Element in a Sorted and Rotated Array” problem we have given a sorted array a[]. This array is rotated at some unknown point, find the minimum element in this array. Input Format The first and only one line containing an integer value n. …

Read moreFind the Minimum Element in a Sorted and Rotated Array

Stock Buy Sell to Maximize Profit

Problem Statement In the “Stock Buy Sell to Maximize Profit” problem we have given an array that contains stock price on each day, find the maximum profit that you can make by buying and selling in those days. Here, we can buy and sell multiple times but only after selling …

Read moreStock Buy Sell to Maximize Profit

Merge Overlapping Intervals II

Problem Statement In the “Merge Overlapping Intervals II” problem we have given a set of intervals. Write a program that will merge the overlapping intervals into one and print all the non-overlapping intervals. Input Format The first line containing an integer n. Second-line containing n pairs where each pair is …

Read moreMerge Overlapping Intervals II