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

Largest Sum Contiguous Subarray

Problem Statement You are given an array of integers. The problem statement asks to find out the largest sum contiguous subarray. This means nothing but to find a subarray (continuous elements) which has the largest sum among all other subarrays in the given array. Example arr[] = {1, -3, 4, …

Construct BST from its given Level Order Traversal

Given the level order traversal of a Binary Search Tree, write an algorithm to construct the Binary Search Tree or BST from ITS given level order traversal. Example Input levelOrder[] = {18, 12, 20, 8, 15, 25, 5, 9, 22, 31} Output In-order : 5 8 9 12 15 18 …

First non Repeating Element

We are given an array A. We have to find the first non repeating element in the array. Example Input: A[]={2,1,2,1,3,4} Output: First non-repeating element is: 3 Because 1, 2 is not the answer because they are repeating and 4 is not the answer because we have to find the …

Remove Minimum Number of Elements Such That no Common Element Exist in both Array

Given two arrays A and B consisting of n and m elements respectively. Remove minimum number of elements such that no common element exist in both array and print the count of elements which removed. Example Input: A[]={ 1, 2, 1, 1} B[]= {1, 1} Output: Minimum elements to remove …

Translate »