Arnab Chakraborty has Published 4452 Articles

Program to count number of sublists with exactly k unique elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:08:47

105 Views

Suppose we have a list of numbers called nums and another value k, we have to find the number of sublists required that there are exactly k unique numbers in the sublist.So, if the input is like nums = [2, 2, 3, 4] k = 2, then the output will ... Read More

Program to find sum of k non-overlapping sublists whose sum is maximum in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:07:09

139 Views

Suppose we have a list of numbers called nums, and another value k, we have to find the k non-overlapping, non-empty sublists such that the sum of their sums is maximum. We can consider k is less than or equal to the size of nums.So, if the input is like ... Read More

Program to find lexicographically smallest subsequence of size k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:04:26

247 Views

Suppose we have a list of numbers called nums and another value k, we have to find the lexicographically smallest subsequence of size k.So, if the input is like nums = [2, 3, 1, 10, 3, 4] k = 3, then the output will be [1, 3, 4]To solve this, ... Read More

Program to justify a set of words by converting them into same length lines in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 10:00:33

66 Views

Suppose we have an list of words and a width k, we have to arrange the text such that each line has exactly k number of characters and the text is fully justified. Here we shall pack our words as many words as we can insert in each line. And ... Read More

Program to find minimum sum of difficulties to complete jobs over k days in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:55:42

110 Views

Suppose we have a list of numbers called jobs and another value k. Now we want to finish all jobs in k different days. The jobs must be performed in the given order and in each day we have to complete one task. The difficulty of job i is stored ... Read More

Program to get maximum profit by scheduling jobs in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:53:00

736 Views

Suppose we have a list of intervals where each interval contains three values [start, end, profit]. We can perform only one task at a time, we have to find the most amount of profit we can get.So, if the input is like intervals = [[1, 2, 100], [3, 5, 40], ... Read More

Program to find all possible IP address after restoration in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:49:18

249 Views

Suppose we have a string with only digits, we have to restore it by forming all possible valid IP address combinations. We know that a valid IP address consists of exactly four integers (each integer is in range 0 to 255) separated by single period symbol.So, if the input is ... Read More

Program to find number of increasing subsequences of size k in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:44:40

368 Views

Suppose we have a list of numbers called nums and also another value k, we have to find the number of subsequences of size k that are strictly increasing. If the answer is very large, mod it by 10^9 + 7.So, if the input is like nums = [2, 3, ... Read More

Program to find cost to reach final index of any of given two lists in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:42:27

86 Views

Suppose we have two lists of numbers nums0 and nums1 of the same length and two other values d as distance and c as cost. If we start from index 0 at either nums0 or nums1 and want to end up at the final index of either list. Now, in ... Read More

Program to find minimum number of pins required to hang all banners in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 12-Dec-2020 09:40:11

247 Views

Suppose we have a list of intervals of the form [start, end] this is representing the starts and end points of banners we want to hang. At least one pin is required to hang a banner, and one pin can hang more than once banners. We have to find the ... Read More

Advertisements