Arnab Chakraborty has Published 4452 Articles

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

Arnab Chakraborty

Arnab Chakraborty

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

265 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

100 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

109 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

118 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

153 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

111 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

116 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

Program to find smallest difference between picked elements from different lists in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Dec-2020 06:08:58

107 Views

Suppose we have a list of lists, we have to find the smallest difference that can be formed by picking one value from each of the lists and taking the difference between the maximum and the minimum number of the picked element.So, if the input is like lists = [ ... Read More

Program to find minimum digits sum of deleted digits in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:19:53

120 Views

Suppose we have two strings s and t of digits, we have to find a way to remove digits in the strings so that: 1. Two strings are same 2. The sum of the digits that are deleted is minimized Finally return the minimized sum.So, if the input is like ... Read More

Program to count number of minimum swaps required to make it palindrome in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:19:13

279 Views

Suppose we have a string s, we have to find the minimum number of adjacent swaps needed to make it into a palindrome. If there is no such way to solve, then return -1.So, if the input is like s = "xxyy", then the output will be 2, as we ... Read More

Advertisements