Arnab Chakraborty has Published 4452 Articles

Program to find number of possible position in n-person line with few person at front and back in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:08:03

96 Views

Suppose we have three numbers n, a and b. Consider we are in a line of n people. And we are unaware about our position in the line. But we know there are at least a number of people in front of us and at most b number of people ... Read More

Program to find lexicographically largest mountain list in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:06:33

159 Views

Suppose we have three positive numbers say n, lower, and upper. We have to find a list whose length is n and that is strictly increasing and then strictly decreasing and all the numbers are in range [lower and upper] (both inclusive). And each increasing and decreasing parts should be ... Read More

Program to find maximum sum by performing at most k negate operations in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:04:36

174 Views

Suppose we have a list of elements called nums we also have another value k. Now let us consider an operation where we select an element from nums and negate it. We can perform exactly k number of operations. We have to find the maximum resulting sum that can be ... Read More

Program to find value for which given array expression is maximized in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 08:01:04

162 Views

Suppose we have two arrays called nums and values, both contains integers and the values of nums are strictly increasing and their lengths are also same. We have to find the value of v for a pair of indices i, j, such that: i ≤ j that maximizes v = ... Read More

Program to find number of elements in matrix follows row column criteria in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:56:54

501 Views

Suppose we have a binary matrix; we have to find the number of elements in matrix that follows the following rules −matrix[r, c] = 1matrix[r, j] = 0 for every j when j is not equal to c and matrix[i, c] = 0 for every i when i is not ... Read More

Program to find k where k elements have value at least k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:54:05

174 Views

Suppose we have a list of numbers called nums, that contains only non-negative numbers. If there are exactly k number of elements in nums that are greater than or equal to k, find the value k. If we cannot find such, then return -1.So, if the input is like nums ... Read More

Program to find array of length k from given array whose unfairness is minimum in python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:51:07

451 Views

Suppose we have an array A and another value k. We have to form an array arr whose size is k bu taking elements from A and minimize the unfairness. Here the unfairness is calculated by this formula −(𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑜𝑓 𝑎𝑟𝑟) − (𝑚𝑖𝑛𝑖𝑚𝑢𝑚 𝑜𝑓 𝑎𝑟𝑟)So, if the input is like ... Read More

Program to find total duration of K most watched shows in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:41:27

91 Views

Suppose we have a list of list of strings called shows, also have a list of integers called durations, and another value k, here shows[i] and durations[i] represent a show and its duration watched by the ith man, we have to find the total duration watched of the k most ... Read More

Program to find expected value of given equation for random numbers in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:38:29

228 Views

Suppose we have a number n. Consider x = rand() mod n, where rand() function generates integers between 0 and 10^100 (both inclusive) uniformly at random. And$$Y = \sqrt{x+\sqrt{x+\sqrt{x+\sqrt{x+...}}}}$$We have to find the expected value of Y. The value of n will be in range 1 and 5*10^6.So, if the ... Read More

Program to count number of intervals which are intersecting at given point in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 11-Oct-2021 07:37:17

219 Views

Suppose we have a list of intervals and a value called point. Each interval interval[i] contains [si, ei] represents start time and end time of interval i (both inclusive). We have to find the number of intervals that are intersecting at given point.So, if the input is like intervals = ... Read More

Advertisements