Arnab Chakraborty has Published 3734 Articles

Program to find two pairs of numbers where difference between sum of these pairs are minimized in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:36:20

284 Views

Suppose we have a list of numbers called nums and we want to select two pairs of numbers from it such that the absolute difference between the sum of these two pairs is minimized.So, if the input is like nums = [3, 4, 5, 10, 7], then the output will ... Read More

Program to find minimum number of operations required to make lists strictly Increasing in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:29:52

307 Views

Suppose we have two list of numbers called A and B, and they are of same length. Now consider we can perform an operation where we can swap numbers A[i] and B[i]. We have to find the number of operations required to make both lists strictly increasing.So, if the input ... Read More

Program to fill Min-max game tree in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:55:51

4K+ Views

Suppose we have a binary tree representing a game state of a two player game. Every internal node is filled with 0 and the leaves values represent the end score. Player 1 wants to maximize the end score while player 2 wants to minimize the end score. Player 1 will ... Read More

Program to find maximum sum of two non-overlapping sublists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:52:48

354 Views

Suppose we have a list of numbers called nums and two values x and y, we have to find the maximum sum of two non-overlapping sublists in nums which have lengths x and y.So, if the input is like nums = [3, 2, 10, -2, 7, 6] x = 3 ... Read More

Program to find maximum sum by removing K numbers from ends in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:51:18

449 Views

Suppose we have a list of numbers called nums and another value k. We have to find the maximum sum of elements that we can delete, given that we must pop exactly k times, where each pop can be from the left or the right end.So, if the input is ... Read More

Program to find maximum additive score by deleting numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:50:07

228 Views

Suppose we have a list of numbers called nums. Let us consider an operation where we can select a number, then remove it and increase our score by the sum of the number and its two adjacent numbers. If we can perform this operation as many times as we want ... Read More

Program to find a target value inside given matrix or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:48:13

479 Views

Suppose we have a 2D matrix, where each row and column is sorted in non-decreasing order, we have to check whether given target is present inside it or not.So, if the input is like243034316632And target = 31, then the output will be TrueTo solve this, we will follow these steps ... Read More

Program to generate matrix where each cell holds Manhattan distance from nearest 0 in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:45:39

266 Views

Suppose we have a binary matrix. We have to find the same matrix, but each cell's value will be the Manhattan distance to the nearest 0. We can assume at least one 0 exists in the matrix.So, if the input is like101101110then the output will be101101210as only the bottom left ... Read More

Program to find number of combinations of coins to reach target in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:43:36

1K+ Views

Suppose we have a list of coins and another value amount, we have to find the number of combinations there are that sum to amount. If the answer is very large, then mod the result by 10^9 + 7.So, if the input is like coins = [2, 5] amount = ... Read More

Program to find lowest sum of pairs greater than given target in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Nov-2020 05:40:22

285 Views

Suppose we have a list of numbers called nums and another value target. We have to find the lowest sum of pair of numbers that is larger than target.So, if the input is like nums = [2, 4, 6, 10, 14] target = 10, then the output will be 12, ... Read More

Advertisements