Arnab Chakraborty has Published 4452 Articles

C++ code to find out which number can be greater

Arnab Chakraborty

Arnab Chakraborty

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

383 Views

Suppose, we are given two k-digit numbers m and n. The digits of the numbers are randomly shuffled and then compared. We have to find out which number has a higher probability to be greater.So, if the input is like n = 231, m = 337, k = 3, then ... Read More

C++ code to find out if a name is male or female

Arnab Chakraborty

Arnab Chakraborty

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

770 Views

Suppose, we are given n strings in an array 'input'. The strings are names, we have to find out if they are male or female names. If a name ends with 'a', 'e', 'i', or 'y'; it can be said that it is a female name. we print 'male' or ... Read More

C++ code to find the number of scans needed to find an object

Arnab Chakraborty

Arnab Chakraborty

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

127 Views

Suppose, we are given a grid of dimensions m x n. An object is placed at cell (ix, iy) and we have to find the object scanning from a starting position (sx, sy). The scanning algorithm scans the ith row and the j-th column of the grid if it is ... Read More

C++ code to find the number of refill packs to be bought

Arnab Chakraborty

Arnab Chakraborty

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

123 Views

Suppose, there are 'a' number of matches and 'b' number of press conferences to be held in a stadium in a particular week. There are two cafeterias, one in the player dressing room and one in the press conference area. There are two soft drink dispensers in the cafeterias and ... Read More

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

Arnab Chakraborty

Arnab Chakraborty

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

390 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

146 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 decrease even numbers in an array

Arnab Chakraborty

Arnab Chakraborty

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

198 Views

Suppose, we are given an array 'arr' of size n that contains positive integer numbers. We have to find the even numbers and decrease them by 1. We print out the array after this process.So, if the input is like n = 7, arr = {10, 9, 7, 6, 4, ... Read More

C++ code to find total elements in a matrix

Arnab Chakraborty

Arnab Chakraborty

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

157 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

104 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

79 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

Advertisements