Arnab Chakraborty has Published 4452 Articles

Program to find smallest value of K for K-Similar Strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 08-Oct-2021 07:24:31

159 Views

Suppose we have two strings s and t. These two strings are K-similar if we can swap the positions of two letters in s exactly K times so that the resulting string is t. So, we have two anagrams s and t, we have to find the smallest K for ... Read More

Program to find maximum subarray min-product in Python

Arnab Chakraborty

Arnab Chakraborty

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

204 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

539 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

188 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

134 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

1K+ 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

345 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

494 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

491 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

493 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

Advertisements