Redirecting to

A Modified Game Of Nim

Given an array of integers, two players Alice and Bob are playing a game where Alice can remove any  element from the array that are multiples of 3. Similarly, Bob can remove multiples of 5. The player who can't remove any element loses the game. The task is to find the winner of the game if Alice starts first and both play optimally.
Input Format
The first line contains integer n, no. of integers.
second line contains n integers arr[1],arr[2]...arr[n].
Output Format
Print the winner (ALICE or BOB).
Question Video
1<= n <= 10^5
1<= arr[i] <= 10^8
Sample Input
15 6 9 10 20
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name