Arnab Chakraborty has Published 4293 Articles

Bomb Enemy in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 09:38:01

359 Views

Suppose we have a 2D grid, here each cell is either a wall 'W', an enemy 'E' or that is empty '0', We have to find the maximum enemies we can kill using one bomb. The bomb kills all the enemies in the same row and column from the planted ... Read More

Sort Transformed Array in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 09:35:05

257 Views

Suppose we have a sorted array of integer nums and integer values a, b and c. We have to apply a quadratic function of the form f(x) = ax^2 + bx + c to each element x in the array. And the final array must be in sorted order.So, if ... Read More

Line Reflection in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 09:32:53

491 Views

Suppose we have n points on a 2D plane, we have to check whether there is any line parallel to y-axis that reflect the given points symmetrically, in other words, check whether there exists a line that after reflecting all points over the given line the set of the original ... Read More

Program to find nth term in Look and Say Sequence in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:28:45

634 Views

Suppose we have a number n we have to generate nth term in “Look and Say” sequence. This is a sequence whose few terms are like below −111211211111221The string will be read like1 (One)11 (One 1) So read the previous 1, and say “One 1”21 (Two 1) So read the ... Read More

Program to find length of longest substring with character count of at least k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:26:55

253 Views

Suppose we have a string s where each characters are sorted and we also have a number k, we have to find the length of the longest substring such that every character occurs at least k times.So, if the input is like s = "aabccddeeffghij" k = 2, then the ... Read More

Program to find length of longest sublist where difference between min and max smaller than k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:24:34

225 Views

Suppose we have a list of numbers called nums and another value k, we have to find the length of longest sublist where the absolute difference between the largest and smallest element is ≤ k.So, if the input is like nums = [2, 4, 6, 10] k = 4, then ... Read More

Program to find length of longest set of 1s by flipping k bits in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:22:23

227 Views

Suppose we have a binary list, so here only 1s and 0s are available and we also have another number k. We can set at most k 0s to 1s, we have to find the length of the longest sublist containing all 1s.So, if the input is like nums = ... Read More

Program to find length of longest strictly increasing then decreasing sublist in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:20:36

474 Views

Suppose we have a list of numbers called nums. We have to find the length of the longest sublist such that (minimum length 3) its values are strictly increasing and then decreasing.So, if the input is like nums = [7, 1, 3, 5, 2, 0], then the output will be ... Read More

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

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:18:32

211 Views

Suppose we have a list of numbers called nums, we have to find the length of longest subsequence that flips sign on each consecutive number.So, if the input is like nums = [1, 3, -6, 4, -3], then the output will be 4, as we can pick [1, -6, 4, ... Read More

Program to find length of longest interval from a list of intervals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 07:16:22

517 Views

Suppose we have a list of intervals where each interval is in form [start, end]. We have to find the longest interval that we can make by merging any number of overlapping intervals.So, if the input is like [[1, 6], [4, 9], [5, 6], [11, 14], [16, 20]], then the ... Read More

Advertisements