Longest Repeated Subsequence

The problem “Longest Repeated Subsequence” states that you are given a string as an input. Find out the longest repeated subsequence, that is the subsequence that exists twice in the string. Example aeafbdfdg 3 (afd) Approach The problem asks us to find out the longest repeated subsequence in the string. …

Read moreLongest Repeated Subsequence

How to check if two given sets are disjoint?

The problem “How to check if two given sets are disjoint?” states that suppose you are given two sets in the form of array say set1[] and set2[]. Your task is to find out whether the two sets are Disjoint Sets or not. Example inputSet1[] = {1, 15, 8, 9, …

Read moreHow to check if two given sets are disjoint?

Construction of Longest Increasing Subsequence (N log N)

Problem Statement You are given an array of integers. The problem “Construction of Longest Increasing Subsequence (N log N)” asks to construct the longest increasing subsequence. Example arr[]={1, 4, 7, 2, 9, 6, 12, 3 } 12, 9, 7, 4, 1 and the size of this longest increasing subsequence is …

Read moreConstruction of Longest Increasing Subsequence (N log N)

Find Minimum In Rotated Sorted Array

Problem Statement “Find Minimum In Rotated Sorted Array” states that you are given a sorted array of size n which is rotated at some index. Find the minimum element in the array. Example a[ ] = {5, 1, 2, 3, 4} 1 Explanation: If we arrange the array in sorted …

Read moreFind Minimum In Rotated Sorted Array

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 moreCount quadruples from four sorted arrays whose sum is equal to a given value x

The Painter’s Partition Problem

Problem Statement The Painter’s Partition problem states that we have some fences and we have some painters. We want to minimize the time of painting all the fences by painters. There is a bound on the order of painting the fences by painters. Consider we have n painters, then painter …

Read moreThe Painter’s Partition Problem

Maximum Subarray Sum Excluding Certain Elements

Problem Statement We are given an array, and we need to find maximum subarray sum excluding certain elements. That is, we need to find the max sum of subarray such that the subarray we are considering does not contain the elements which are told to be excluded. Example of maximum …

Read moreMaximum Subarray Sum Excluding Certain Elements

Count items common to both the lists but with different prices

Problem Statement You are given two lists. Each of which index contains the name of the item and its price. The problem statement asks to count items common to both the lists but with different prices, which is to find out how many numbers of items are common in both …

Read moreCount items common to both the lists but with different prices