Arnab Chakraborty has Published 4293 Articles

Program to length of longest increasing path in a given matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:45:43

164 Views

Suppose we have a 2D matrix, we have to find the length of the longest strictly increasing path. To traverse the path we can move up, down, left, or right nor diagonally.So, if the input is like246157339then the output will be 6, as The longest path is [1, 2, 4, ... Read More

Program to find length of longest palindromic subsequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:45:08

850 Views

Suppose we have a lowercase string s; we have to find the length of the longest palindromic subsequence in s.So, if the input is like s = "aolpeuvekyl", then the output will be 5, as the palindrome is "level".To solve this, we will follow these steps −n := size of ... Read More

Program to find length of longest path with even sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:39:35

198 Views

Suppose we have a binary tree. we have to find the length of the longest path whose sum is an even number.So, if the input is like image, then the output will be 5, as the path is like [5, 2, 4, 8, 5], sum = 24(even).To solve this, we ... Read More

Program to find length of longest common subsequence of three strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:36:12

686 Views

Suppose we have three strings s1, s2, and s3, we have to find the length of their longest common subsequence.So, if the input is like s1 = "ababchemxde" s2 = "pyakcimde" s3 = "oauctime", then the output will be 4, as the longest common subsequence is "acme".To solve this, we ... Read More

Program to find length of longest arithmetic subsequence of a given list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:34:52

367 Views

Suppose we have a list of numbers called nums, we have to find the length of the longest arithmetic subsequence. As we know a sequence S[i] is an arithmetic sequence when S[i+1] - S[i] have the same value for every i in range (0 ≤ i < Size of S ... Read More

Program to find length of longest alternating subsequence from a given list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:32:00

484 Views

Suppose we have a list of numbers called nums, we have to find the size of the longest subsequence where the difference between two consecutive numbers alternate between positive and negative. And the first difference may be either positive or negative.So, if the input is like nums = [6, 10, ... Read More

Program to check whether we can split list into consecutive increasing sublists or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:30:32

387 Views

Suppose we have a list of numbers called nums and that is sorted in non-decreasing order, we have to check whether it can be split into any number of subsequences such that each subsequence has at minimum length of 3 and that is consecutively increasing.So, if the input is like ... Read More

Program to split lists into strictly increasing sublists of size greater than k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:27:46

193 Views

Suppose we have a list of numbers called nums, and another value k, we have to check whether it is possible to split the list into sublists lists such that each sublist has length ≥ k and that is strictly increasing. The list does not need to be split contiguously.So, ... Read More

Program to find largest sum of 3 non-overlapping sublists of same sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:26:38

156 Views

Suppose we have a list of numbers called nums and another value k, we have to find the largest sum of three non-overlapping sublists of the given list of size k.So, if the input is like nums = [2, 2, 2, -6, 4, 4, 4, -8, 3, 3, 3] k ... Read More

Program to find maximum sum of two sets where sums are equal in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:23:56

166 Views

Suppose we have a list of numbers called nums, now find two sets as their sums are same and maximum, then find sum value.So, if the input is like nums = [2, 5, 4, 6], then the output will be 6, as the sets are [2, 4] and [6].To solve ... Read More

Advertisements