Arnab Chakraborty has Published 4452 Articles

Program to find final amount that should be paid to employees based on their performance in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:54:40

146 Views

Suppose we have two lists of numbers of same length called performance and costs. And we also have another number k. These indicates that each worker i performs at performance[i] level and it takes costs at least costs[i]. We have to find the minimum cost to hire k employees given ... Read More

Program to count number of unique subsequences of a string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:54:01

529 Views

Suppose we have a string s, we have to find the number of non-empty unique subsequences of s. If the answer is very large then mod the result by 10^9 + 7.So, if the input is like s = "xxy", then the output will be 5, as there are five ... Read More

Program to find number of distinct island shapes from a given matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:52:44

216 Views

Suppose we have a 2d binary matrix, we have to find the number of distinct islands in the given matrix. Here 1 represents land and 0 represents water, so an island is a set of 1s that are close and whose perimeter is surrounded by water. Here two islands are ... Read More

Program to count number of ways we can make a list of values by splitting numeric string in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:50:41

74 Views

Suppose we have a strings s. The s is containing digits from 0 - 9 and we also have another number k. We have to find the number of different ways that s can be represented as a list of numbers from [1, k]. If the answer is very large ... Read More

Program to find number of coins we can pick from topleft to bottom-right cell and return in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:48:38

93 Views

Suppose we have a 2D matrix with 3 possible values −0 for an empty cell.1 for a coin.−1 for a wall.We have to find the maximum number of coins we can take by starting from the top−left cell and reaching the bottom−right cell by moving only right or down direction. ... Read More

Program to check person 1 can win the candy game by taking maximum score or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:44:27

250 Views

Suppose two players are playing a game. Where several candies placed on a line, and person 1 is given a list of numbers called nums that is representing the point value of each candy. On each person's turn, they can pick 1, 2, or 3 candies from the front of ... Read More

Program to check whether first player can take more candies than other or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:43:07

97 Views

Suppose we have a list of numbers called candies and two persons are racing to collect the most number of candies. Here the race is turn based, person 1 is starting first, and in each turn he can pick up candies from the front or from the back. We have ... Read More

Program to count number of permutations where sum of adjacent pairs are perfect square in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:40:54

136 Views

Suppose we have a list of numbers called nums. We have to find the number of permutations of nums such that sum of every pair of adjacent values is a perfect square. Two permutations A and B are unique when there is some index i where A[i] is not same ... Read More

Program to check whether final string can be formed using other two strings or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:38:50

95 Views

Suppose we have two strings s, t, and another string r we have to check whether there is any way to get r by merging characters in order from s and t.So, if the input is like s = "xyz" t = "mno" r = "xymnoz", then the output will ... Read More

Program to count number of flipping required to make all x before y in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 26-Dec-2020 10:37:17

112 Views

Suppose we have a lowercase string s with letters x and y. Now consider an operation in which we change a single x to y or vice versa. We have to find the minimum number of times we need to perform that operation to set all x's come before all ... Read More

Advertisements