Arnab Chakraborty has Published 4293 Articles

Program to find k sublists with largest sums and return sums in ascending order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:36:22

165 Views

Suppose we have a list of numbers called nums, and another value k, we have to find k sublists with the largest sums and return the sums in non-decreasing order.So, if the input is like nums = [2, 4, 5, -100, 12, -30, 6, -2, 6] k = 3, then ... Read More

Program to find a sub-list of size at least 2 whose sum is multiple of k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:34:05

144 Views

Suppose we have a list of non-negative numbers called nums and another positive value k. We have to find check whether there is any sublist of length at least 2 whose sum is multiple of k or not.So, if the input is like nums = [12, 6, 3, 4] k ... Read More

Program to find number of elements in A are strictly less than at least k elements in B in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:32:36

2K+ Views

Suppose we have two lists of numbers A and B, and another value k, we have to find the number of elements in A that are strictly less than at least k elements in B.So, if the input is like A = [6, -2, 100, 11] B = [33, 6, ... Read More

Program to check number of global and local inversions are same or not in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:30:40

163 Views

Suppose we have a list of distinct numbers called nums. Here a global inversion is when there's indices i < j such that nums[i] > nums[j]. And local inversion is when there is an index i and i + 1 such that nums[i] > nums[i + 1]. We have to ... Read More

Program to merge intervals and sort them in ascending order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:28:45

885 Views

Suppose we have a list intervals, we have to find the union of them in sorted sequence.So, if the input is like inv = [[2, 5], [4, 10], [20, 25]], then the output will be [[2, 10], [20, 25]]To solve this, we will follow these steps −sort the list intervalsans ... Read More

Program to find overlapping intervals and return them in ascending order in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:26:33

347 Views

Suppose we have a list of closed intervals and another list of intervals. Individually, each list is non-overlapping and they are sorted in non-decreasing order. We have to find the overlap of the two intervals sorted in non-decreasing order.So, if the input is like inv1 = [[50, 100], [190, 270], ... Read More

Program to find total unique duration from a list of intervals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:25:00

1K+ Views

Suppose we have a list of intervals where each list represents an interval [start, end] (inclusive). We have to find the total unique duration it covers.So, if the input is like intervals = [[2, 11], [13, 31], [41, 61]], then the output will be 50, as the total unique covered ... Read More

Program to find intervals that do not intersect the cut interval in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:23:27

235 Views

Suppose we have a sorted and disjoint intervals list and another list cut, that represents an interval. We have to delete all parts of intervals that are intersecting with cut interval, and return the new list.So, if the input is like intervals = [[2, 11], [13, 31], [41, 61]] cut ... Read More

Program to find Inorder Successor of a binary search tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:21:30

700 Views

Suppose we have a binary search tree BST and another value of a node, we have to find the in-order successor of that node in the BST. As we all know that the successor of a node p is the node with the smallest key greater than the value of ... Read More

Program to find number of minimum steps to reach last index in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:19:24

533 Views

Suppose we have a list of numbers called nums and we are placed currently at nums[0]. On each step, we can either jump from the current index i to i + 1 or i - 1 or j where nums[i] == nums[j]. We have to find the minimum number of ... Read More

Advertisements