❄ Easy Java Solution❄ Beats 100% of Java Users . 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public boolean stoneGameIX(int[] stones) {
        int n = stones.length ; 
        int[] m = new int[3] ;
        for( int i : stones ){
            ++m[i%3] ; 
        }
        if( m[1] == 0 && m[2] == 0 ){
            return false  ; 
        }
        int curr = 0 ; 
        if( m[1] > 0 ){  
            curr = Math.min( m[1]-1 , m[2] ) ; 
            if( m[1] - curr > 2 && m[0] % 2 == 1 ){
                return true ; 
            }else if( m[2] > curr && m[0] % 2 == 0 ) {
                return true ; 
            }
        }
        if( m[2] > 0 ){
            curr = Math.min( m[2] - 1 , m[1] ) ; 
            if( m[1] == curr && m[2] - curr == 1 ){
                return false ; 
            }else if( m[2] - curr > 2 && m[0] % 2 == 1){
                    return true ; 
            }else if ( m[1] > curr && m[0] % 2 == 0  ) {
                    return true ; 
            }
        }
        return false  ;
    }
}
```
['Array', 'Math', 'Java']