Arnab Chakraborty has Published 3734 Articles

Program to find number of sublists whose sum is given target in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:59:39

566 Views

Suppose we have a list of numbers called nums and another value target, we have to find the number of sublists whose sum is same as target.So, if the input is like nums = [3, 0, 3] target = 3, then the output will be 4, as we have these ... Read More

Program to find number of K-Length sublists whose average is greater or same as target in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:57:25

287 Views

Suppose we have a list nums, and two additional values k and target, we have to find the number of sublists whose size is k and its average value ≥ target.So, if the input is like nums = [1, 10, 5, 6, 7] k = 3 target = 6, then ... Read More

Program to count number of fraction pairs whose sum is 1 in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:55:17

2K+ Views

Suppose we have a list of fractions where each fraction is individual lists [numerator, denominator] which represents the number (numerator / denominator). We have to find the number of pairs of fractions whose sum is 1.So, if the input is like fractions = [[2, 7], [3, 12], [4, 14], [5, ... Read More

Program to find number not greater than n where all digits are non-decreasing in python

Arnab Chakraborty

Arnab Chakraborty

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

346 Views

Suppose we have a number n, we have to find the largest number smaller or equal to n where all digits are non-decreasing.So, if the input is like n = 221, then the output will be 199.To solve this, we will follow these steps:digits := a list with all digits ... Read More

Program to generate first n lexicographic numbers in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:48:34

384 Views

Suppose we have a number n, we have to find first n numbers that are sorted in lexicographic sequence.So, if the input is like n = 15, then the output will be [1, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9]To solve this, we ... Read More

Program to find number of distinct combinations that sum up to k in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:46:38

435 Views

Suppose we have a list of distinct numbers called nums and another number k, we have to find the number of distinct combinations that sum up to k. You can reuse numbers when creating combinations.So, if the input is like nums = [2, 4, 5] k = 4, then the ... Read More

Program to find minimum number of movie theatres required to show all movies in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:44:17

335 Views

Suppose we have a list of intervals for different movie showings (they can be overlapped), we have to find the minimum number of theatres required to be able to show all of the movies.So, if the input is like intervals = [[20, 65], [0, 40], [50, 140]], then the output ... Read More

Program to find most occurring number after k increments in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:42:25

219 Views

Suppose we have a list of numbers called nums and another value k. Let us consider an operation where we increase some element by one. We can perform at most k times, we have to find the value of the most frequently occurring number we can obtain. If there are ... Read More

Program to find sum of minimum trees from the list of leaves in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:40:48

260 Views

Suppose we have a list of numbers called nums. This list is representing the leaf nodes in inorder traversal of a tree. Here the internal nodes have have 2 children and their value is same as the product of the largest leaf value of its left subtree and the largest ... Read More

Program to find minimum sum subsequence by taking at least one element from consecutive 3 elements in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 25-Nov-2020 12:38:27

1K+ Views

Suppose we have a a list of numbers called nums, we have to find a minimum sum subsequence from the given list such that at least one number for all groups of three consecutive numbers is selected. If the length of given list is less than 3, a number should ... Read More

Advertisements