Arnab Chakraborty has Published 4293 Articles

C++ code to find winner of math contest

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 14:19:42

421 Views

Suppose we have two arrays P and T of size n. And have another number c. Amal and Bimal are going to participate one math contest. There are n problems. The ith problem has initial score P[i], and takes T[i] to solve it. P and T both are sorted in ... Read More

C++ code to count children who will get ball after each throw

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 14:16:35

1K+ Views

Suppose we have a number n. Few kids are standing on a circle. They are numbered from 1 to n, they are in clockwise order and the child number 1 is holding the ball. First the child number 1 throws the ball to the next one clockwise, Then the child ... Read More

C++ code to find minimum time needed to do all tasks

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 14:14:31

504 Views

Suppose we have an array A with n elements, and two other arrays k and x. The ith task takes A[i] time to complete. The given A is sorted in non-decreasing fashion. Amal takes at most k tasks and do each of them in x units of time instead of ... Read More

C++ code to count who have declined invitation

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 14:11:40

183 Views

Suppose we have an array A with n elements, and all elements are distinct. There are n of the onsite finalists who can join a company, their qualifying ranks are present in array A. We have to find the minimum possible number of contestants that declined the invitation to compete ... Read More

C++ code to count columns for calendar with month and first day

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 14:08:43

339 Views

Suppose we have two numbers m and d. Consider a calendar where week days are represented as columns and rows are current days. We want to know how many columns in the calendar should have given the month m and the weekday of the first date of that month d ... Read More

C++ code to check query for 0 sum

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 13:58:37

145 Views

Suppose we have an array A with n elements, the elements are in range -1 to 1. And have another array of pairs for m queries Q like Q[i] = (li, ri). The response to the query will be 1 when the elements of array a can be rearranged so ... Read More

C++ code to get maximum profit by house making

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 13:56:03

292 Views

Suppose we have two numbers n and h, and another array of m triplets T, where T[i] = (li, ri, xi). On a road, there are n places where we can make houses. The spots are numbered as 1 to n. The house height can be from 0 to h. ... Read More

C++ code to check given matrix is good or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 13:15:01

288 Views

Suppose we have one n x n matrix. The matrix is said to be a good matrix where every number not equal to 1 can be expressed as the sum of a number in the same row and a number in the same column. We have to check whether given ... Read More

C++ code to check water pouring game has all winner or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 13:08:18

266 Views

Suppose we have an array A with n elements and have another number s. There is one empty water mug and n non-empty water mugs on the table. In a game, there are few players. In each move, a player takes a non-empty mug of water and pours all water ... Read More

C++ code to find index where this is a hash collision

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Mar-2022 13:05:42

416 Views

Suppose we have a number p and another array X with n elements. There is a hash table with p buckets. The buckets are numbered from 0 to p-1. We want to insert n numbers from X. We are assuming for X[i], its bucket will be selected by the hash ... Read More

Advertisements