Arnab Chakraborty has Published 4293 Articles

C++ code to find out if everyone will get ice cream

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 08:39:44

467 Views

Suppose, there are three groups of people coming to a party. The first group of people likes butterscotch ice cream and do not like any other flavors of ice cream, the second group of people only dislikes strawberry ice cream and like every other flavor, and the third group likes ... Read More

C++ code to find out if a grid is fully accessible

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 08:36:58

230 Views

Suppose, we are given a grid that has 2 rows and n columns. A robot is at position (0, 0) in the grid and wants to visit (1, n - 1) by visiting adjacent and corner cells to its current location. We are given the grid in an array of ... Read More

C++ code to find total elements in a matrix

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Mar-2022 08:29:08

211 Views

Suppose, we are given a matrix of n rows and m columns. We have to find out the number of elements present in it. We find out the value and display it as output.So, if the input is like n = 20, m = 15, then the output will be ... Read More

C++ code to count maximum hay-bales on first pile

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 07:03:37

157 Views

Suppose we have an array A with n elements and another value d. A farmer has arranged n haybale piles on the firm. The ith pile contains A[i] hay-bales. Every day a cow can choose to move one hay-bale in any pile to an adjacent pile. The cow can do ... Read More

C++ code to find name with O's on Fibonacci positions

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 07:01:34

122 Views

Suppose we have a number n. Amal wants to give a name to his pet. He will follow an algorithm. The name will be n characters long. The name will contain uppercase and lowercase letters 'O's and 'o's. The algorithm suggests the i-th letter of the name should be 'O' ... Read More

C++ code to find position of students after coding contest

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 06:58:57

377 Views

Suppose we have an array A with n elements. In a coding contest, in total n students will participate, and before the start, every one of them has some positive rating (integer). A[i] represents the rating of ith student. After the contest ends, every student will end up with some ... Read More

C++ code to find tree height after n days

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 06:56:23

236 Views

Suppose we have an array A with n elements. A has elements either 0 or 1. There is a tree. In consecutive n days, if A[i] is 0 it is not watered, if it is 1 then it is watered, the flower grows in the following manner −If the tree ... Read More

C++ code to find minimum different digits to represent n

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 06:50:03

156 Views

Suppose we have a number n. We want to split it into some non-zero digits whose sum is n. We want to find a solution with minimum possible number of different digits.So, if the input is like n = 13, then the output will be [1, 1, 1, 1, 1, ... Read More

C++ code to check all bulbs can be turned on or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 06:46:48

363 Views

Suppose we have a number m and a nested list A with n sub-lists. Consider there are m bulbs, initially all are turned off. There are n buttons and each of them is connected to some set of bulbs. So A[i] is the set of bulbs that can be turned ... Read More

C++ code to count order collected when client calls

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 06:44:25

300 Views

Suppose we have three numbers n, m and z. An office receives calls in every n minutes, and some deliveries come to office in every m minutes. Office is open for z minutes. We have to count the minimum number of orders are collected so there are no pending orders ... Read More

Advertisements