Game of Stones Problem Statement
Two players, 'Ale' and 'Bob', are playing a game with a pile of stones. Your task is to determine the winner if both play optimally.
Rules of the Game:
1. On each turn, a player can choose to take either one stone or any even number of stones.
2. Players play alternately, with 'Ale' always going first, followed by 'Bob'.
3. If a player cannot take any stones, the other player wins the game.
Input:
The first line contains an integer ‘T’, the number of test cases.
Each test case contains a single integer, representing the total number of stones in the game.
Output:
For each test case, return a string 'Ale' or 'Bob' indicating the winner.
Example:
Input:
T = 2
7
10
Output:
'Ale'
'Bob'
Constraints:
- 1 <= T <= 105
- 1 <= number of stones <= 109
Note:
- Do not print anything; return 'Ale' if 'Ale' will win the game, otherwise return 'Bob'.

AnswerBot
4mo
Determine the winner of a game where two players take stones alternately, with specific rules.
Implement a recursive function to simulate the game, considering the rules provided.
Check if the current p...read more
Help your peers!
Add answer anonymously...
Samsung Software Developer Intern interview questions & answers
A Software Developer Intern was asked 7mo agoQ. Suppose an array of length n sorted in ascending order is rotated between 1 and ...read more
A Software Developer Intern was asked 7mo agoQ. What are the ACID properties in DBMS?
A Software Developer Intern was asked Q. Sum of Digits Problem Statement Given an integer 'N', continue summing its digit...read more
Popular interview questions of Software Developer Intern
A Software Developer Intern was asked 6mo agoQ1. Suppose an array of length n sorted in ascending order is rotated between 1 and ...read more
A Software Developer Intern was asked 6mo agoQ2. What are the ACID properties in DBMS?
A Software Developer Intern was asked Q3. Sum of Digits Problem Statement Given an integer 'N', continue summing its digit...read more
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

