Arnab Chakraborty has Published 4452 Articles

Program to find minimum possible difference of indices of adjacent elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:18:31

179 Views

Suppose we have a list of numbers nums, we can say that two numbers nums[i] ≤ nums[j] are adjacent when there is no number in between (nums[i], nums[j]) in nums. We have to find the minimum possible |j - i| such that nums[j] and nums[i] are adjacent.So, if the input ... Read More

Program to count number of words we can generate from matrix of letters in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:17:50

184 Views

Suppose we have a 4 x 4 board of letters and a list of words, we have to find the largest number of words that can be generated in the board by a sequence of adjacent letters, using one cell at most once per word (but we can reuse cells ... Read More

Program to find intervals by merging target interval in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:16:58

94 Views

Suppose we have a list of non-overlapping intervals. These are sorted based on end time. We have another interval target, find final interval after merging target so that intervals are still non-overlapping and sorted.So, if the input is like intervals = [[1, 15], [25, 35], [75, 90]], target = [10, ... Read More

Program to find list of elements which are less than limit and XOR is maximum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:16:11

125 Views

Suppose we have a list of numbers nums and a list of queries where each query contains [x, limit]. We have to find a list such that for each query [x, limit], we find an element e in nums such that e ≤ limit and e XOR x is maximized. ... Read More

Program to find length of subsequence that can be removed still t is subsequence of s in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:15:18

139 Views

Suppose we have a string s and another string t. And t is a subsequence of s. We have to find the maximum length of a substring that we can remove from s so that, t is still a subsequence of s.So, if the input is like s = "xyzxyxz" ... Read More

Program to find maximum possible value of smallest group in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 10:14:34

188 Views

Suppose we have a list of numbers called nums and another value k. We have to split the list into k contiguous groups. The smallest group is the one whose sum is the smallest out of all the groups. So find the maximum possible value of the smallest group.So, if ... Read More

Program to find how max score we can get by removing 10 or 01 from binary string in Python

Arnab Chakraborty

Arnab Chakraborty

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

263 Views

Suppose we have a binary string s and two values zero_one and one_zero. Now let us consider an operation where we can delete any substring "01" and receive zero_one points. Or we can remove any substring "10" and receive one_zero points. We have to find the maximum number of points ... Read More

Program to find a triplet nums[i] < nums[k] < nums[j] from a list nums in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 08:57:29

213 Views

Suppose we have a list of numbers called nums, we have to check whether there are triplets (i, j, k) such that i < j < k and nums[i] < nums[k] < nums[j].So, if the input is like nums = [2, 12, 1, 4, 4], then the output will be ... Read More

Program to remove all islands which are completely surrounded by water in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 08:55:56

575 Views

Suppose we have a binary matrix where 1 represents land and 0 represents water. And an island is a group of 1's that are surrounded by 0s (water) or by the edges. We have to find all of the islands that are completely surrounded by water and modify them into ... Read More

Program to find length of shortest supersequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 08:52:38

125 Views

Suppose we have two strings s and t. We have to find the length of the shortest string that has both s and t as subsequences.So, if the input is like s = "pipe" t = "people", then the output will be 7, as one possible supersequence is "pieople".To solve ... Read More

Advertisements