1.20
这里写自定义目录标题
- 1. 每日一题——石子游戏
1. 每日一题——石子游戏
class Solution {public boolean stoneGameIX(int[] stones) {int cnt0 = 0, cnt1 = 0, cnt2 = 0;for (int val : stones) {int type = val % 3;if (type == 0) {++cnt0;} else if (type == 1) {++cnt1;} else {++cnt2;}}if (cnt0 % 2 == 0) {return cnt1 >= 1 && cnt2 >= 1;}return cnt1 - cnt2 > 2 || cnt2 - cnt1 > 2;}
}
发布者:admin,转转请注明出处:http://www.yc00.com/news/1692511727a602526.html
评论列表(0条)