Arnab Chakraborty has Published 4452 Articles

Program to check sublist sum is strictly greater than the total sum of given list Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:15:54

219 Views

Suppose we have a list of numbers called nums, we have to check whether there is a sublist such that its sum is strictly greater than the total sum of the list.So, if the input is like nums = [1, −2, 3, 4], then the output will be True, as ... Read More

Program to multiply two strings and return result as string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:13:42

1K+ Views

Suppose we have two numbers as string. We have to multiply them and return the result also in string. So if the numbers are “28” and “25”, then the result will be “700”To solve this, we will follow these steps −Taking two arguments x and y it indicates x divides ... Read More

Program to check maximum sum of all stacks after popping some elements from them in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:11:52

213 Views

Suppose we have a list of stacks, we can take any stack or stacks and pop any number of elements from it. We have to find the maximum sum that can be achieved such that all stacks have the same sum value.So, if the input is like stacks = [[3, ... Read More

Program to find product of few numbers whose sum is given in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:09:45

169 Views

Suppose we have a number n, we have to find two or more numbers such that their sum is equal to n, and the product of these numbers is maximized, we have to find the product.So, if the input is like n = 12, then the output will be 81, ... Read More

Program to sort an array based on the parity values in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:07:37

196 Views

Suppose, we have an array A with few integers. We have to sort the numbers as even then odd. So put the even numbers at first, then the odd numbers. So if the array is like A = [1, 5, 6, 8, 7, 2, 3], then the result will be ... Read More

Program to find smallest intersecting element of each row in a matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:06:05

117 Views

Suppose we have a 2D matrix where each row is sorted in ascending order. We have to find the smallest number that exists in every row. If there's no such result, then return −1.So, if the input is like23551010135then the output will be 5To solve this, we will follow these ... Read More

Program to find sibling value of a binary tree node in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:03:46

530 Views

Suppose we have a value k and a binary search tree, here each node is either a leaf or contains 2 children. We have to find the node containing the value k, and return its sibling's value.So, if the input is likek = 4., then the output will be 10.To ... Read More

Program to split a set into equal sum sets where elements in first set are smaller than second in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 11:00:47

686 Views

Suppose we have a list of numbers called nums, we have to check whether we can divide the list into two groups A and B such that: The sum of A and the sum of B are same. Here every number in A is strictly smaller than every number in ... Read More

Program to count total number of set bits of all numbers in range 0 to n in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 10:58:45

124 Views

Suppose we have a number num. For each numbers i in the range 0 ≤ i ≤ num we have to calculate the number of 1's in their binary counterpart and return them as a list. So if the number is 5, then the numbers are [0, 1, 2, 3, ... Read More

Program to count minimum number of animals which have no predator in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Oct-2020 10:56:48

688 Views

Suppose we have a list of numbers called nums where nums[i] shows the predator of the ith animal and if there is no predator, it will hold −1. We have to find the smallest number of groups of animals such that no animal is in the same group with its ... Read More

Advertisements