One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
Tag - dynamic programming
One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
Given two positive integers n and k, print all increasing sequences of length k such that the elements in every sequence are from first n natural numbers.
Given two strings str1 and str2, find if str1 is a subsequence of str2. A subsequence is a sequence that can be derived from another sequence by deleting
Given an array of random numbers, find longest monotonically increasing subsequence (LIS) in the array.If you want to understand the O(NlogN) approach.
Mobile Numeric Keypad Problem - Dynamic Programming Given the mobile numeric keypad. You can only press buttons that are up, left, right or down
Java Programming - Count number of binary strings without consecutive 1’s - Dynamic Programming Positive integer, count all possible distinct binary string
C++ Programming - Bellman Ford Algorithm - Dynamic Programming Given a graph and a source vertex src in graph, find shortest paths from src to all vertices
Java Programming - Bellman–Ford Algorithm - Dynamic Programming Given a graph and a source vertex src in graph, find shortest paths from src to all vertices
Longest Palindromic Substring - Dynamic Programming -Given a string,find the longest substring which is palindrome. For example, if the given string ing is