Arnab Chakraborty has Published 4293 Articles

Find maximum sum of triplets in an array such than i < j < k and a[i] < a[j] < a[k] in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 11:05:35

570 Views

Suppose we have an array of positive numbers, there are n elements in that array, we have to find the maximum sum of triplet (ai + aj + ak ) such that 0 A[i], thensecond_max := maximum of second_max, A[j]if first_max and second_max is non-zero, thenres := maximum of ... Read More

Find maximum points which can be obtained by deleting elements from array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 11:02:23

274 Views

Suppose we have an array A with N elements, we also have two integers l and r where, 1≤ ax ≤ 10^5 and 1≤ l≤ r≤ N. Taking an element from the array say ax and remove it, and also remove all elements equal to ax+1, ax+2 … ax+R and ... Read More

Find maximum operations to reduce N to 1 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:59:50

262 Views

Suppose we have two numbers P and Q and they form a number N = (P!/Q!). We have to reduce N to 1 by performing maximum number of operations possible. In each operation, one can replace N with N/X when N is divisible by X. We will return the maximum ... Read More

Find maximum N such that the sum of square of first N natural numbers is not more than X in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:57:52

202 Views

Suppose we have a given integer X, we have to find the maximum value N so that the sum of first N natural numbers should not exceed the value X.So, if the input is like X = 7, then the output will be 2 as 2 is the maximum possible ... Read More

Find maximum length Snake sequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:54:38

658 Views

Suppose we have a grid of numbers; we have to find a snake sequence and return it. If there are multiple snake sequence, then return only one. As we know a snake sequence is made using adjacent numbers in the grid so for each number, the number on the right-hand ... Read More

Find maximum distance between any city and station in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:50:44

252 Views

Suppose we have N number of cities, and they are numbered from 0 to N-1 and we also have the cities in which stations are located, we have to find the maximum distance between any city and its nearest station. We have to keep in mind that the cities with ... Read More

Find maximum difference between nearest left and right smaller elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:49:04

271 Views

Suppose we have an array of integers; we have to find the maximum absolute difference between the nearest left and the right smaller element of each of the elements in the array. If there is no smaller element on the right-hand side or left-hand side of any element then we ... Read More

Find lost element from a duplicated array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 10:01:10

304 Views

Suppose we have two arrays which are duplicates of each other except one element, so, one element from one of the given arrays is missing, we have to find that missing element.So, if the input is like A = [2, 5, 6, 8, 10], B = [5, 6, 8, 10], ... Read More

Find longest palindrome formed by removing or shuffling chars from string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:58:29

302 Views

Suppose we have a string; we have to find the longest palindrome that can be generated by deleting or shuffling the characters from the string. And if there are more than one palindrome then return only one.So, if the input is like pqqprrs, then the output will be pqrsrqp.To solve ... Read More

Find longest bitonic sequence such that increasing and decreasing parts are from two different arrays in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Aug-2020 09:56:08

167 Views

Suppose we have two arrays; we have to find the longest possible bitonic sequence so that the increasing part should be from first array and should be a subsequence of first array. similarly decreasing part of must be from second array and a subsequence of the second one.So, if the ... Read More

Advertisements