Arnab Chakraborty has Published 4452 Articles

C++ code to kid chair association

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:50:15

209 Views

Suppose we have a number n. We have to find an array A of size n. There are n tables and each table has 4 chairs. Chairs are numbered from 1 to 4n. It is known that two kids who sit on chairs with numbers a and b (a != ... Read More

C++ code to find total time to pull the box by rabbit

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:47:43

214 Views

Suppose we have two coordinates (x1, y1) and (x2, y2). A rabbit is pulling food box. He is attached with a rope with only 1 unit sized rope. Rabbit will pull the box to where it is standing before moving out of the way in the same direction by 1 ... Read More

C++ code to count number of notebooks to make n origamis

Arnab Chakraborty

Arnab Chakraborty

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

117 Views

Suppose we have two numbers n and k. In a party there are n invited friends. Amal wants to make invitations in the form of origami. For each invitation, he needs two red papers, five green papers, and eight blue papers. There are infinite number of notebooks of each color, ... Read More

C++ code to find two substrings with one minimal substring

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:43:29

95 Views

Suppose we have a lowercase string S with n characters. We have to find two non-empty substrings P and Q, such that −Both P and Q are subsequences of SFor each index i, S[i] belong to exactly one of P and Q.P is lexicographically minimum as possible.So, if the input ... Read More

C++ program to find winner of card game

Arnab Chakraborty

Arnab Chakraborty

Updated on 15-Mar-2022 05:41:48

514 Views

Suppose we have a number n, two arrays A and B of size k1 and k2 respectively. Amal and Bimal are playing interesting card game. There are n cards, numbered 1 to n. Initially the cards are distributed between them. The game goes as follows: on each turn, each player ... Read More

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

Arnab Chakraborty

Arnab Chakraborty

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

177 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

148 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

59 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

275 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

193 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

Advertisements