Arnab Chakraborty has Published 4293 Articles

Program to find minimum difference between two elements from two lists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:35:00

2K+ Views

Suppose we have two lists L1 and L2, we have to find the smallest difference between a number from L1 and a number from L2.So, if the input is like L1 = [2, 7, 4], L2 = [16, 10, 11], then the output will be 3, as the smallest difference ... Read More

Program to find minimum number of deletions required from two ends to make list balanced in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:33:38

210 Views

Suppose we have a list containing 0s and 1s, we have to remove values from the front or from the back of the list. Finally, we have to find the minimum number of deletions required such that the remaining list has an equal number of 0s and 1s.So, if the ... Read More

Program to merge two binary trees in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:29:27

206 Views

Suppose we have two binary trees and consider that when we put one of them to cover the other, some nodes of the two trees are overlapped while the others are overlapping. We have to merge them into a new binary tree. The merge rule is like that if two ... Read More

Program to find maximum length of non-sharing words in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:26:17

238 Views

Suppose we have a list of lowercase alphabetical strings called words, we have to find the maximum sum of the lengths of two distinct words that do not share a common letter. So, if the input is like words = ["abcd", "mno", "abdcmno", "amno"], then the output will be 7, ... Read More

Program to find maximum sum of non-adjacent nodes of a tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:24:39

328 Views

Suppose we have a binary tree, we have to find the maximum sum of the values that can be obtained given no two values can be adjacent parent to child.So, if the input is likethen the output will be 17 as 10, 4, 3 are not adjacent to each other.To ... Read More

Program to maximize the number of equivalent pairs after swapping in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:21:26

235 Views

Suppose we have a list of numbers A and list of numbers B of same length. We also have a 2D list of numbers C where each element is of the form [i, j] this indicates we can swap A[i] and A[j] as many times as we want. We have ... Read More

Program to maximize the minimum value after increasing K sublists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:19:15

245 Views

Suppose we have a list of numbers called nums and two values, size and k. Now suppose there is an operation where we take a contiguous sublist of length size and increment every element by one. We can perform this operation k times, we have to find the largest minimum ... Read More

Program to make pairwise adjacent sums small in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:16:59

340 Views

Suppose we have a list of non-negative numbers say nums and a non-negative value k. Now suppose we can perform an operation where we select a single positive umber in nums and decrease it by 1. We have to find the minimum number of operations required such that every pair ... Read More

Program to find number of coins needed to make the changes with given set of coins in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:15:15

273 Views

Suppose we have coins of different denominations and a total amount of money amount. We have to define one function to compute the fewest number of coins that we need to make up that amount. When that amount of money cannot be accommodated by any combination of the coins, return ... Read More

Program to find number of coins needed to make the changes in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Oct-2020 15:13:36

1K+ Views

Suppose we have coins of different denominations (1, 5, 10, 25) and a total amount of money amount. We have to define one function to compute the fewest number of coins that we need to make up that amount. So if the input is 64, the output is 7. This ... Read More

Advertisements