Arnab Chakraborty has Published 4293 Articles

Program to find maximum subarray min-product in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:18:59

291 Views

Suppose we have an array nums, we have to find the maximum min-product of each non-empty subarray of nums. Since the answer can be big enough, return it in modulo 10^9+7. The min-product of the array is equal to the minimum value in the array multiplied by the sum of ... Read More

Program to find maximum distance between a pair of values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:16:10

680 Views

Suppose we have two arrays (non-growing) nums1 and nums2. The index pair (i, j) with 0

Program to check whether we can split a string into descending consecutive values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:12:02

251 Views

Suppose we have a string s with only numbers. We have to check whether we can split s into two or more non-empty substrings such that the numerical values of those substrings are in non-increasing sequence and the difference between numerical values of every two adjacent substrings is 1. So ... Read More

Program to find maximum element after decreasing and rearranging in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:07:56

206 Views

Suppose we have an array called arr. We have to perform some operations on arr so that it satisfies these conditions −The first element in arr must be 1.The absolute difference between any 2 adjacent elements must be at most 1.And there are two operations. We can perform these two ... Read More

Program to implement seat reservation manager in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:03:49

2K+ Views

Suppose we have to design a system that manages the reservation state of n seats. The seats are numbered from 1 to n. So we have to implement the SeatReserveManager class, with these functions −Constructor that takes n as input and initializes the object that will manage n seats numbered ... Read More

Program to find closest subsequence sum in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:00:04

470 Views

Suppose we have an array nums and another value goal. We want to select a subsequence of nums such that the sum of its elements is the nearest to goal. So in other words, if the sum of the subsequence's elements is s, then we want to minimize the absolute ... Read More

Program to find longest substring of all vowels in order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 13:18:48

644 Views

Suppose we have a string s with only English vowels, we have to find the length of the longest beautiful substring of s. If we cannot find such substring then, return 0. A string is said to be beautiful if it satisfies the following conditions −Each of the 5 vowels ... Read More

Program to find frequency of the most frequent element in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 13:13:52

634 Views

Suppose we have an array nums and another value k. In one operation, we can select an index of nums and increase the element at that index by 1. We have to find the maximum possible frequency of an element after performing at most k number of operations.So, if the ... Read More

Program to find maximum ice cream bars in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 13:08:09

672 Views

Suppose we have an array costs with n elements, where costs[i] is the price of the ith ice cream bar in coins. We initially have c number coins to spend, and we want to buy as many ice cream bars as possible. We have to find the maximum number of ... Read More

Program to find maximum XOR for each query in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 13:04:49

283 Views

Suppose we have an array which is presorted called nums of size n and also have one value b. We want to perform the following query n times −Search for a non-negative value k < 2^m such that XOR of all elements in nums and k is maximized. So k ... Read More

Advertisements