Arnab Chakraborty has Published 4452 Articles

Program to find number of islands, from where we cannot leave in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:42:17

137 Views

Suppose we have a binary matrix. Here 1 represents land and 0 represents water. From any land we can move up, down, left or right but not diagonally to another land cell or go off the matrix. We have to find the number of land cells from which we cannot ... Read More

Program to find stone removal rate in K hours in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:37:15

70 Views

Suppose we have a list of numbers called piles and a value k. The piles[i] represents, the number of stones on the pile i. On each hour, we select any pile and remove r number of stones from that pile. If we pick a pile with fewer than r stones, ... Read More

Program to find dropped correct sensor value from the faulty list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:34:20

83 Views

Suppose we have two lists nums1 and nums2, they are representing sensor metrics. Each list contains unique values, so a ≠ b. One of these two lists are holding accurate sensor metrics but the other one contains faulty. In the faulty list one value, that is not the last value ... Read More

Program to count number of ways ball can drop to lowest level by avoiding blacklisted steps in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:32:08

162 Views

Suppose we have a value h and a list of numbers called blacklist. We are currently at height h, and are playing a game to move a small ball down to height 0. Now, in even rounds (starting from 0) we can move the ball 1, 2, or 4 stairs ... Read More

Program to count number of operations needed to make string as concatenation of same string twice in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:27:50

119 Views

Suppose we have a lowercase string s. Now consider an operation, where we can delete, insert or update any character in s. We have to count minimum number of operations required to make s = (t concatenate t) for any string t.So, if the input is like s = "pqrxqsr", ... Read More

Program to find length of smallest sublist that can be deleted to make sum divisible by k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:16:36

140 Views

Suppose we have a list with positive values, called nums and also have a positive number k. We have to find the length of the shortest sublist (may be empty) that we can delete from nums, such that sum of the remaining elements is divisible by k. But we cannot ... Read More

Program to find minimum deletions to make strings strings in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:14:27

423 Views

Suppose we have two lowercase strings s and t, now consider an operation where we can delete any character in any of these two strings. We have to find the minimum number of operations needed to make s and t equal.So, if the input is like s = "pipe" t ... Read More

Program to find maximum profit after cutting rods and selling same length rods in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:11:39

344 Views

Suppose we have a list of rod lengths called rodLen. We also have another two integers called profit and cost, represents profit per length and cost per cut. We can make gain profit per unit length of a rod but we can only sell rods that are all of the ... Read More

Program to find maximum length of k ribbons of same length in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:08:11

1K+ Views

Suppose we have a list of positive numbers, representing ribbons length and also have one value k. We can cut the ribbons as many times as we want, we have to find the largest length r such that we can have k ribbons of length r. If we cannot find ... Read More

Program to reduce list by given operation and find smallest remaining number in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Oct-2021 12:06:08

215 Views

Suppose we have a list of positive numbers called nums. Now consider an operation where we remove any two values a and b where a ≤ b and if a < b is valid, then insert back b-a into the list nums. If we can perform any number of operations, ... Read More

Advertisements