Arnab Chakraborty has Published 3734 Articles

Program to find maximum number of package that can be bought by buyers in C++

Arnab Chakraborty

Arnab Chakraborty

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

334 Views

Suppose we have two lists sales and buyers. Each element in sales contains two values in the form [day, price] this indicates the package is available for sale only on that day for that given price. And each element in buyers in the form [payday, amount] indicates that the buyer ... Read More

Program to get maximum value of power of a list by rearranging elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:44:36

694 Views

Suppose we have a list nums of N positive numbers. Now we can select any single value from the list, and move (not swap) it to any position. We can also not move any to position at all. So we have to find what is the maximum possible final power ... Read More

Program to find length of longest increasing subsequence with at least k odd values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:40:36

267 Views

Suppose we have a list of numbers called nums and another value k, we have to find the size of the longest increasing subsequence with at least k odd elements.So, if the input is like nums = [12, 14, 16, 5, 7, 8] k = 2, then the output will ... Read More

Program to find number of operations needed to decrease n to 0 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:38:57

245 Views

Suppose we have a number n. Now consider an operation where we can either 1. Decrement n by one 2. If n is even number, then decrement it by n / 2 3. If n is divisible by 3, then decrement by 2 * (n / 3) Finally find the ... Read More

Program to get next integer permutation of a number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:36:12

486 Views

Suppose we have a number n, we have to find the next bigger permutation of its digits. When n is already in its largest permutation, then rotate it down to the smallest permutation.So, if the input is like n = 319, then the output will be 391.To solve this, we ... Read More

Program to get final position of moving animals when they stops in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:24:50

246 Views

Suppose we have a string s that is representing the initial conditions of some animals. Each animal can take one of three values: L, indicates the animal moved to left. R, indicates the animal moved to right. @, indicates the animal is standing still. Animals moving on a direction will ... Read More

Program to count minimum k length sublist that can be flipped to make all items of list to 0 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:20:49

156 Views

Suppose we have a list of numbers called nums that stored 0s and 1s. We have another value k.Now consider there is an operation where we flip a sublist of length k such that all 1s will be 0s and all 0s will be 1s. We have to find the ... Read More

Program to find minimum radius to light up all houses on a street in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Dec-2020 06:18:26

761 Views

Suppose we have a list of numbers called nums that are representing position of houses on a 1-dimensional line. Now consider we have 3 street lights that we can put anywhere on the line and a light at position x lights up all houses in range [x - r, x ... Read More

Program to find minimum string size that contains given substring in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Dec-2020 14:08:50

447 Views

Suppose we have two strings s and t, we have to find the size of a minimum substring in s that contains all the characters of t. If there is no such substring exists then return -1.So, if the input is like s = "thegrumpywizardmakes" t = "wake", then the ... Read More

Program to Find Out the Maximum Points From Removals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Dec-2020 13:16:35

295 Views

Suppose we are provided with a list of positive numbers. Now, here we can remove any contiguous sub list of some length t with the same value and get points t * t. One condition is to be considered, that we can perform this any number of times until the ... Read More

Advertisements