Arnab Chakraborty has Published 4452 Articles

Program to find maximum score from performing multiplication operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:55:36

226 Views

Suppose we have two arrays nums and multipliers of size n and m respectively (n >= m). The arrays are 1-indexed. Now our initial score is 0. We want to perform exactly m operations. On the ith operation (1-indexed), we will −Select one value from x from either the start ... Read More

Program to find maximum number of non-overlapping substrings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:55:00

529 Views

Suppose we have a string s with only lowercase letters, we have to find find the maximum number of non-empty substrings of s that meet the following rulesSubstrings are non-overlappingA substring that contains a specific character ch must also contain all occurrences of ch.We have to find the maximum number ... Read More

Program to find minimum number of increments on subarrays to form a target array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:54:33

214 Views

Suppose we have an array called target with positive values. Now consider an array initial of same size with all zeros. We have to find the minimum number of operations required to generate a target array from the initial if we do this operation: (Select any subarray from initial and ... Read More

Program to find minimum number of operations to move all balls to each box in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:51:33

587 Views

Suppose we have a binary string called boxes, where boxes[i] is '0' indicates the ith box is empty, and '1' indicates it contains one ball. Now, in one operation, we can move one ball from a box to an adjacent box. After doing so, there may be more than one ... Read More

Program to find best position for a service center in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:47:26

90 Views

Suppose we have a list of positions, which is containing a list of coordinate points where some houses are located. If you want to make a service center at (xc, yc) such that the sum of Euclidean distance from any given point to (xc, yc) is minimum. So we have ... Read More

Program to generate array by concatenating subarrays of another array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:43:13

197 Views

Suppose we have one 2D array called groups, and another array nums. We have to check whether we can select n disjoint subarrays from the array nums such that the ith subarray is equal to groups[i] (0-indexed), and if i > 0, the (i-1)th subarray will appear before the ith ... Read More

Program to check whether Amal can win stone game or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:42:04

111 Views

Suppose there are two players Amal and Bimal, they are playing a game, and with Amal starts first. Initially, there are n different stones in a pile. On each player's turn, he makes a move consisting of removing any square number (non-zero) of stones from the pile. Also, if one ... Read More

Program to find minimum possible integer after at most k adjacent swaps on digits in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:39:46

128 Views

Suppose we have a string called num representing a very large integer number and also have another value k. We can swap any two adjacent digits of the values at most k times. We have to find the minimum value we can get.So, if the input is like num = ... Read More

Program to find minimum limit of balls in a bag in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:37:19

362 Views

Suppose we have an array nums where the ith element indicates a bag containing nums[i] number of balls. We also have another value called mx. We can perform the following operation at most mx times −Select any bag of balls and divide it into two new bags with at least ... Read More

Program to find max value of an equation in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 06-Oct-2021 08:36:30

397 Views

Suppose we have an array called points containing the coordinate points on a 2D plane, they are sorted by the x-values, where points[i] = (x_i, y_i) so x_i < x_j for all 1

Advertisements