Arnab Chakraborty has Published 4293 Articles

Program to find out the position of a ball after n reversals in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 08:12:19

260 Views

Suppose, there are n number of balls. The balls are ordered in a fashion 1, 2, 3, 4, ..., n. Now the balls are reversed in order, or ordered in a way n, n-1, n-2, ......, 2, 1. The balls are again reversed in order, this time they are reversed ... Read More

Program to reset a polygon to its initial state in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 08:05:20

204 Views

Suppose, there is a polygon with n vertices, n flipping axis, and n rotation points. The following are true for the flipping axes and rotation pointsIf n is odd, each flipping axis passes through only one vertex and the middle of the opposite side.If n is even, half of the ... Read More

Program to find out the cells containing maximum value in a matrix in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:58:07

281 Views

Suppose, there is a n x n matrix initialized with 0s. Now, a list is given and it contains some pairs that contain a particular row and a column position. For each item i in the list, the contents of the cells increase by 1 where the row number and ... Read More

Program to find out number of blocks that can be covered in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:55:05

316 Views

Suppose there are n blocks in a path, and a worker is putting colored tiles on the blocks. The worker is putting blocks in a way, such that if a block number in the path is divisible by 4 or/and 2 but not 42, he puts a colored tile there. ... Read More

Program to apply Russian Peasant Multiplication in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:52:50

513 Views

Suppose we are given four integer numbers p, q, r, and k. We will use a method called the Russian Peasant Multiplication method and determine the value of (p + q.i)^r = r + s.i. We have to return the value of r mod k and s mod k.So, if ... Read More

Program to find out the number of integral coordinates on a straight line between two points in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:50:14

300 Views

Suppose, we have been provided with two points (p1, q1) and (p2, q2). We have to find out the number of integral coordinates (both the x and y values are integers) if a straight line is drawn between the two given points. The number of points is returned.So, if the ... Read More

Program to find number of possible moves to start the game to win by the starter in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:47:51

300 Views

Suppose Amal and Bimal are playing a game. They have n containers with one or more chocolates inside it. These containers are numbered from 1 to N, where ith container has count[i] number of chocolates. Now the game is like. First player will select a container and take one or ... Read More

Program to find winner of a rower breaking game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:44:55

374 Views

Suppose we have an array height. There are n different towers with different height. Amal and Bimal are playing a game. The game rules are like belowAmal always plays firstDuring each move, the current player selects a tower of height X and break it down into Y different towers of ... Read More

Program to find winner of a set element removal game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:33:09

199 Views

Suppose We have a set of first n natural numbers {1..n}. Amal and Bimal are playing a game.The game rules are like belowAmal always plays firstDuring each move, the current player selects a prime number p from the set. The player then removes p and all of its multiples from ... Read More

Program to find winner of number reducing game in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 23-Oct-2021 07:30:31

221 Views

Suppose Amal and Bimal are playing a game. They have a number n and they check whether it is a power of 2 or not. If it is, they divide it by 2. otherwise, they reduce it by the next lower number which is also a power of 2. Whoever ... Read More

Advertisements