Alice and Bob take turns playing a game, with Alice starting first.

Initially, there is a number n on the chalkboard. On each player's turn, that player makes a move consisting of:


	Choosing any x with 0 &lt; x &lt; n and n % x == 0.
	Replacing the number n on the chalkboard with n - x.


Also, if a player cannot make a move, they lose the game.

Return true if and only if Alice wins the game, assuming both players play optimally.

&nbsp;
Example 1:

Input: n = 2
Output: true
Explanation: Alice chooses 1, and Bob has no more moves.


Example 2:

Input: n = 3
Output: false
Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.


&nbsp;
Constraints:


	1 &lt;= n &lt;= 1000


class Solution:
    def divisorGame(self, n: int) -> bool:
                
        """
        let's forget about Alice and Bob for a second and just concentrate on the n and plays
        if played optimally :
        
        1 - player at 1 will loose since no factors
        2 - player at 2 will win by choosing 1
        3 - player at 3 will loose always since he/she has to choose 1. and then next player will always win because they are at 2
        4 - player at 4 will win by choosing 1 as a factor as next player will have to play at 3
        5 - player at 5 will loose because he has to choose 1, and player at 4 will always win
        6 - player at 6 will always win by choosing 3 as a factor
        7 - player at 7 will have to choose 1, and hence result 6 will make player at 6 to win
        8 - player at 8 can choose 1 and win always
        .
        .
        .
        .
        Pattern detected
        
        Now, since Alice is the first player we can return bool values accordingly
        
        
        """
        
        return n%2 == 0
        
        
class Solution {
    public boolean divisorGame(int n) {
        return n%2==0;
    }
}
class Solution {
public:
    bool divisorGame(int n) {
        if(n%2==0) return true;
        return false;
    }
};
var divisorGame = function(n) {
    let count = 0;
    while(true){
        let flag = true;
        for(let i = 1;i<n;i++){
if(n%i==0){
    flag = false;
    n = n-i;
    break;
}
            
        }
        if(flag){
if(count %2==0) return false;
            else return true;
}
        count++;
    }
};
Divisor Game