Arnab Chakraborty has Published 4293 Articles

Stone Game II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:44:15

451 Views

Suppose there are two persons Alice and Bob, they are continuing their games with piles of stones. There are a number of piles placed in a row, and each pile has a positive integer number of stones in an array piles[i]. Our objective of the game is to end with ... Read More

Smallest Range II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:40:40

262 Views

Suppose we have an array A of integers, for each integer A[i] we have to choose either x = -K or x = K, and add x to A[i] (only once). So after this process, we have some array B. We have to find the smallest possible difference between the ... Read More

Longest Well-Performing Interval in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:40:28

251 Views

Suppose we have hours list, this is a list of the number of hours worked per day for a given employee. Here a day is considered to be a tiring day if and only if the number of hours worked is (strictly) greater than 8. One well-performing interval is an ... Read More

Corporate Flight Bookings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:38:07

200 Views

Suppose we have n flights, and they are labeled from 1 to n. We have a list of flight bookings. The i-th booking indicates using bookings[i] = [i, j, k] this means that we booked k seats from flights labeled i to j inclusive. Find an array answer of length ... Read More

Car Pooling in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:35:10

835 Views

Suppose there is a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east, so we cannot turn around and drive west. We have given a list of trips, trip[i] = [num_passengers, start_location, end_location], that contains information about the ith trip:, so that is the ... Read More

Largest Values From Labels in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:32:56

190 Views

Suppose we have a set of items: the i-th item has value values[i] and label labels[i]. Then, we will take a subset S of these items, such that −|S|

Letter Tile Possibilities in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:24:26

593 Views

Suppose we have a set of tiles, where each tile has one letter tiles[i] printed on it. Find the number of possible non-empty sequences of letters that we can make. So if the input is “AAB”, then the output will be 8. As sequences are “A”, “B”, “AA”, “AB”, “BA”, ... Read More

Flip Columns For Maximum Number of Equal Rows in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:20:01

254 Views

Suppose we have a matrix consisting of 0s and 1s, we can choose any number of columns in the matrix and flip every cell in that column. converting a cell changes the value of that cell from 0 to 1 or from 1 to 0. we have to find the ... Read More

Distant Barcodes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:16:13

161 Views

Suppose in a warehouse, there is a row of barcodes. The i-th barcode is barcodes[i]. We have to rearrange the barcodes so that no two adjacent barcodes are same. So if the input is [1, 1, 1, 2, 2, 2] so output is [2, 1, 2, 1, 2, 1].To solve ... Read More

Previous Permutation With One Swap in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Apr-2020 12:09:47

420 Views

Suppose we have an array A of positive integers (not necessarily unique), we have to find the lexicographically largest permutation that is smaller than A, that can be made with one swap (A swap exchanges the positions of two numbers A[i] and A[j]). If it cannot possible, then return the ... Read More

Advertisements