## 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. …

## Maximum path sum in a triangle

Problem Statement   The problem “Maximum path sum in a triangle” states that you are given some integers. These integers are arranged in the form of a triangle. You are starting from the top of the triangle and need to reach the bottom row. For doing this, you move to the …

## Difference Array | Range update query in O(1)

You are given an integer array and two types of queries, one is to add a given number in a range and the other to print the whole array. The problem “Difference Array | Range update query in O(1)” requires us to perform the range updates in O(1). Example   arr[] …

## Delete Nth node from the end of the given linked list

Problem Statement   The problem “Delete Nth node from the end of the given linked list”  states that you are given a linked list with some nodes. And now you need to remove nth node from the end of the linked list. Example   2->3->4->5->6->7 delete 3rd node from last 2->3->4->6->7 Explanation: …

## Find all pairs (a, b) in an array such that a % b = k

Problem Statement   The problem “Find all pairs (a, b) in an array such that a % b = k” states that you are given an array of integers and an integer value called k. The problem statement asks to find out the pair in such a way that that x …

## Subset with sum divisible by m

Problem Statement   The problem “Subset with sum divisible by m” states that you are given an array of non-negative integers and an integer m. Now you need to find if there is a subset having sum divisible by m. That is the sum of the subset should give 0 as …

## Check if any two intervals overlap among a given set of intervals

Problem Statement   The problem “Check if any two intervals overlap among a given set of intervals” states that you are given some set of intervals. Each interval consists of two values, one is starting time and the other is ending time. The problem statement asks to check if any of …

## Word Wrap Problem

Problem Statement   The word wrap problem states that given a sequence of words as input, we need to find the number of words that can be fitted in a single line at a time. So, for doing this we put breaks in the given sequence such that the printed document …

## Smallest Palindrome after Replacement

Problem Statement   In the “Smallest Palindrome after Replacement” problem we have given the input string contains lower case alphabets characters and dots(.). We need to replace all dots with some alphabet character in such a way that the resultant string becomes a palindrome. The palindrome should be lexicographically smallest. Input …