Arnab Chakraborty has Published 4293 Articles

C++ program to count number of minimum coins needed to get sum k

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:24:02

235 Views

Suppose we have two numbers n and k. We have unlimited number of coins worth values 1 to n. We want to take some values whose sum is k. We can select multiple same valued coins to get total sum k. We have to count the minimum number of coins ... Read More

C++ program to choose some numbers for which there will be no subset whose sum is k

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:22:14

226 Views

Suppose we have two numbers n and k. We have to choose the maximum number of distinct elements from 1 to n, so that no subset whose sum is equal to k. If we can find then return the chosen numbers.So, if the input is like n = 5; k ... Read More

C++ program to find winner of typing game after delay timing

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:20:12

321 Views

Suppose we have five numbers s, v1, v2, t1 and t2. Amal and Bimal are playing a typing game, they are playing their game online. In this game they will type a string whose length is s. Amal types one character in v1 milliseconds and Bimal types one character in ... Read More

C++ program to count number of minutes needed to increase stick length to form a triangle

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:07:55

263 Views

Suppose we have three numbers a, b and c. There are three sticks whose lengths are a, b and c. In one minute, we can pick one arbitrary stick and increase its length by 1 cm, but we cannot break sticks. We have to count the minimum number of minutes ... Read More

C++ program to check we can make two strings equal by swapping from third string

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:03:25

300 Views

Suppose we have three strings S, T and U of same length n. For every index i in range 0 to n-1, we must swap U[i] with either S[i] or T[i]. So in total we have performed n swapping operations. We have to check whether after such n operations we ... Read More

C++ program to find maximum possible median of elements whose sum is s

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 11:00:07

350 Views

Suppose we have two numbers n and s. We have to find the maximum possible median of an array of n non-negative elements, such that the sum of elements is same as s.So, if the input is like n = 3; s = 5, then the output will be 2, ... Read More

C++ program to find permutation with n peaks

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:56:54

275 Views

Suppose we have two numbers n and k. We have to construct a permutation A using the numbers from 1 to n which has exactly k peaks. An index i is said to be peak of an array A, if A[i] > A[i-1] and A[i] > A[i+1]. If this is ... Read More

C++ program to check three items circularly likes next item or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:51:51

108 Views

Suppose we have an array A with n elements. There are n planes on Earth and they are numbered from 1 to n. The plane with number i likes plane A[i]. A[i] != i. We have to check whether there are three planes p, q, and r where p likes ... Read More

C++ program to find perfect array of size n whose subarray is a good array

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:48:51

196 Views

Suppose we have a number n. An array B is good if the sum of its elements is divisible by the length of this array. We can say an array A with n elements is perfect, if non-empty subarray of this array A is good and elements in A is ... Read More

C++ program to count number of problems can be solved from left or right end of list

Arnab Chakraborty

Arnab Chakraborty

Updated on 03-Mar-2022 10:43:31

279 Views

Suppose we have an array A with n elements and another number k is there. Consider there are n problems on a contest. Amal's problem solving skill is k. Amal always solves problem from any of the ends of a list. And He cannot solve problem whose difficulty is greater ... Read More

Advertisements