Arnab Chakraborty has Published 4293 Articles

Program to find lexicographically largest mountain list in Python

Arnab Chakraborty

Arnab Chakraborty

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

268 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

254 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

245 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

663 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

324 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

586 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

149 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

274 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

318 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

Program to insert new element into a linked list before the given position in Python

Arnab Chakraborty

Arnab Chakraborty

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

1K+ Views

Suppose we have a list of elements; these elements are stored in a singly linked list. We also have a value pos and value val. We have to insert val before index pos of the linked list.So, if the input is like nums = [1, 5, 3, 6, 8] pos ... Read More

Advertisements