Arnab Chakraborty has Published 4293 Articles

C++ code to find final number after min max removal game

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:36:51

259 Views

Suppose we have an array A with n elements. There are n numbers written on a board. Amal and Bimal are playing a turn based game. In each turn, they select a number and remove it from board. Amal plays first. Amal wants to minimize the last number that he ... Read More

C++ code to find how many upgrade to make HP greater than current

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:34:58

296 Views

Suppose we have a number n. In a game, every character has four different health points (HP). The categories are as follows −Category A : If HP is in the form (4n + 1)Category B : If HP is in the form (4n + 3)Category C : If HP is ... Read More

C++ code to check we flew to Florida more than Seattle

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:32:57

88 Views

Suppose we have a string S with two kinds of letters 'S' and 'F'. If S[i] is 'S' we are at Seattle on ith day, and if it is 'F' we are at Florida. We have to check whether we flew more times from Seattle to Florida than Florida to ... Read More

C++ code to find pair of numbers where one is multiple of other

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:25:28

354 Views

Suppose we have two numbers l and r. We have to find such pair (x, y), such that l

C++ code to count number of dice rolls to get target x

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:24:02

275 Views

Suppose we have a number x. We have a six-faced dice and its faces are numbered from 2 to 7. We want exactly x points from the dice. When we throw the dice the face number will be added up to reach our target. We do not really care about ... Read More

C++ code to check string is diverse or not

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:12:34

316 Views

Suppose we have a string S with n lowercase letters. A string is called diverse if it has consecutive letters of the English alphabet and each letter occurs exactly once. (letters 'a' and 'z' are not adjacent). We have to check whether it is diverse or not.So, if the input ... Read More

C++ code to find max ornaments to make decoration good

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:10:40

252 Views

Suppose we have three numbers y, b and r. There are y yellow ornaments, b blue ornaments and r red ornaments for decoration. A decoration will be beautiful, if the number of blue ornaments used is greater by exactly 1 than the number of yellow ornaments, and the number of ... Read More

C++ code to find rank of student from score table

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:01:52

976 Views

Suppose we have a 2d array of size n x 4. Consider there are n students and their ids are starting from 0 to n-1. Each of them has four scores on English, Geography, Maths and History. In the table, the students will be sorted by decreasing the sum of ... Read More

C++ code to find minimum moves with weapons to kill enemy

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 04:58:48

736 Views

Suppose we have an array A with n elements, and another number H. H is health of an enemy. We have n weapons and damaging power of ith weapon is A[i]. Different weapons can be used to kill the enemy. We cannot use same weapon twice in a row. We ... Read More

C++ code to get updated string with same 'a' and 'b' count

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 04:55:38

178 Views

Suppose we have as string S with even length n. S contains only two types of characters 'a' and 'b'. We want to modify the string so that every its prefix of its length has an equal amount of letters 'a' and 'b'. To achieve that, we can perform the ... Read More

Advertisements