Arnab Chakraborty has Published 4452 Articles

Program to find number of distinct coin sums we can make with coins and quantities in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:12:25

473 Views

Suppose we have a list of values called coins and another list called quantities of the same length. The value of ith coin is coins[i] and we currently have quantities[i] number of ith coin. We have to find number of distinct coin sum values we can get by using non-empty ... Read More

Program to find a pair (i, j) where nums[i] + nums[j] + (i -j) is maximized in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:10:15

225 Views

Suppose we have a list of numbers called nums, we have to find a pair (i, j) where i < j, and nums[i] + nums[j] + (i - j) is maximized.So, if the input is like nums = [6, 6, 2, 2, 2, 8], then the output will be 11, ... Read More

Program to find length of longest diminishing word chain in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:08:50

143 Views

Suppose we have a list of valid words, and have a string s also, we have to find the length of the longest chain of diminishing words that can be generated by starting at s and removing single letters and still make valid words.So, if the input is like words ... Read More

Program to find cost to remove consecutive duplicate characters with costs in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:07:01

393 Views

Suppose we have a string with lowercase letters and we also have a list of non-negative values called costs, the string and the list have the same length. We can delete character s[i] for cost costs[i], and then both s[i] and costs[i] is removed. We have to find the minimum ... Read More

Program to print maximum number of characters by copy pasting in n steps in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 09:00:23

63 Views

Suppose we have a number n; we have to find the maximum number of characters we can enter using n operations where each operation is likeInserting the character "x".Copy all characters.PasteSo, if the input is like n = 12, then the output will be 81.To solve this, we will follow ... Read More

Program to count minimum number of operations required to make numbers non coprime in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:57:53

221 Views

Suppose we have two numbers A and B. Now in each operation, we can select any one of the number and increment it by 1 or decrement it by 1. We have to find the minimum number of operations we need such that the greatest common divisor between A and ... Read More

Program to find next state of next cell matrix state in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:54:17

109 Views

Suppose we have a 2D binary matrix where a 1 means a live cell and a 0 means a dead cell. A cell's neighbors are its immediate horizontal, vertical and diagonal cells. We have to find the next state of the matrix using these rulesAny living cell with two or ... Read More

Program to remove all nodes with only one child from a binary tree in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:51:15

502 Views

Suppose we have a binary tree root; we have to remove all nodes with only one child.So, if the input is likethen the output will beTo solve this, we will follow these steps:Define a method called solve(), this will take tree rootif root is null, thenreturn rootif left of root ... Read More

Program to find length of longest possible stick in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:47:08

183 Views

Suppose we have a list of integers sticks. Here each element in the list represents a stick with two ends, these values are between 1 and 6. These are representing each end. We can connect two sticks together if any of their ends are same. The resulting stick's ends will ... Read More

Program to find a matrix for each condominium's height is increased to the maximum possible height in Python?

Arnab Chakraborty

Arnab Chakraborty

Updated on 10-Nov-2020 08:44:10

188 Views

Suppose we have a 2D matrix, where matrix [r, c] represents the height of a condominium in a city. The west-east skyline is visible by taking the maximum of each row in the matrix. And the north-south skyline can be visible by taking the maximum of each column. We have ... Read More

Advertisements