Arnab Chakraborty has Published 4293 Articles

Program to find sum of widths of all subsequences of list of numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:29:06

153 Views

Suppose we have a list of numbers called nums, The width of a sequence of numbers as the difference between the maximum and minimum number in the sequence. We have to find the sum of widths of all subsequences of nums. If the answer is very large then mod the ... Read More

Program to find number of sublists containing maximum and minimum after deleting only one element in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:27:51

223 Views

Suppose we have a list of numbers called nums and we can delete at most one element in the list. We have to find the maximum number of sublists that contain both the maximum and minimum values of the resulting list.So, if the input is like nums = [3, 2, ... Read More

Program to find size of sublist where product of minimum of A and size of A is maximized in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:25:49

153 Views

Suppose we have a list of numbers called nums and another value pos. We have to find a sublist A of nums that includes the index pos such that (minimum of A) * (size of A) is maximized then return the value.So, if the input is like nums = [-2, ... Read More

Program to expand string represented as n(t) format in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:23:51

368 Views

Suppose we have a string s, this is encoding a longer string. s is represented as the concatenation of n(t), n(t) represents the concatenation of t, n times, and t is either a regular string or it is another encoded string recursively. We have to find the decoded version of ... Read More

Program to find k where given matrix has k by k square of same value in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:21:22

176 Views

Suppose we have a 2d matrix, we have to find the largest k × k submatrix where all of its elements are containing the same value, then find the value of k.So, if the input is like1183155525554555then the output will be 3, as there is a 3 × 3 square ... Read More

Program to count number of palindromes after minimum number of split of the string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:18:41

147 Views

Suppose we have a lowercase string s, we have to split it into as few strings as possible such that each string is a palindrome and then find the number of strings.So, if the input is like s = "levelracecar", then the output will be 2, as there are two ... Read More

Program to find minimum largest sum of k sublists in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:17:00

182 Views

Suppose we have a list of numbers called nums and another value k. We can split the list into k non-empty sublists. We have to find the minimum largest sum of the k sublists.So, if the input is like nums = [2, 4, 3, 5, 12] k = 2, then ... Read More

Program to find minimum cost to increase heights of trees where no adjacent tree has same height in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:14:54

245 Views

Suppose we have a list of numbers called heights that represents the height of plants and we have another list of values called costs that represents the price needed to increase height of a plant by one. We have to find the smallest cost to make each height in the ... Read More

Program to find maximum value of k for which we can maintain safe distance in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:13:10

164 Views

Suppose we have a binary matrix. Here 0 signifies an empty cell, and a 1 signifies a cell with a person. The distance between two cells is the maximum value between the difference in x coordinates and the difference in y coordinates. Now matrix is considered safe with a factor ... Read More

Program to find size of smallest sublist whose sum at least target in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:10:54

206 Views

Suppose we have a list of numbers called nums, and an another input called target, we have to find the size of the shortest sublist such that its sum value is same as target or larger. If there is no such sublist then return -1.So, if the input is like ... Read More

Advertisements