Wednesday, 1 Dec 2021
Category: Game Theory

Given an array arr of length N with values 1 and 2 indicating type 1 and type 2 elements and two players, player1 and player2. The task is to find the minimum number of coins required to remove all the elements in the order given in the array. Below rules must be followed:Player1 and Player2 […]

Given two integers K and N, and also given that Alice and Bob are playing a game. In a single move, a player can choose a number in the range [1, K], and the player whose number makes the total equal to N wins the game. Print Alice if Alice wins the game, else Bob, […]

Given an integer N, find the minimum number of operations to change N to 1. If not possible, print -1. One operation is defined as either converting N to the number 2*N or converting N to the number N/10(only if N is divisible by 10).Examples:Input: N = 50Output: 3Explanation: N can be converted to 1 […]

Given an array arr[] of size N, denoting values assigned to N stones, two players, Player1 and Player2, play a game of alternating turns. In each turn, a player can take 1, 2, or 3 stones from the first remaining stones with the sum of values of all the removed stones added to the player’s […]

Maximum money that can be collected by both the players in a game of removal of coinsGiven an array arr[] consisting of N positive integers, such that arr[i] represents the value of the coin, the task is to find the maximum amount of money that can be obtained by each player when two players A […]

Find the winner of a game of donating i candies in every i-th moveGiven two integers X and Y representing the number of candies allocated to players A and B respectively, where both the players indulge in a game of donating i candies to the opponent in every ith move. Starting with player A, the […]

#include using namespace std;  bool isValid(vector& board,             int i, int j, int K){    if (board[i][j]

Find the player who wins the game of placing alternate + and – signs in front of array elements Given an array arr[] of length, N, the task is to find the winner of a game played by two players A and B optimally, by performing the following operations: Player A makes the first move. […]

#include using namespace std;    int N, M;    #define MAXM 100 #define MAXN 100    int dx = { -1, 0, 1, -1, 0, 1, -1, 0, 1 }; int dy = { 0, 0, 0, -1, -1, -1, 1, 1, 1 };    bool isValid(int x, int y) {     return (x >= 0 […]