problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::stone_game_ix::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static bool stoneGameIX (vector< int > &stones)
 

详细描述

在文件 leetcode.h539 行定义.

成员函数说明

◆ stoneGameIX()

bool leetcode::stone_game_ix::Solution::stoneGameIX ( vector< int > &  stones)
static

在文件 leetcode.cpp1178 行定义.

1178 {
1179 unsigned int remove = 0;
1180 unsigned int counts[3] = {0, 0, 0};
1181 for(auto stone: stones) {
1182 stone %= 3;
1183 counts[stone]++;
1184 }
1185 if(stones.size() == 1) {
1186 return false;
1187 }
1188 if(counts[1] + counts[2] == 2) {
1189 if(counts[1] == 2 || counts[2] == 2) {
1190 return false;
1191 }
1192 }
1193 if(counts[1] == 0 && counts[2] == 0) {
1194 return false;
1195 }
1196 if(abs(static_cast<int>(counts[1]) - static_cast<int>(counts[2])) <= 2) {
1197 return counts[0] % 2 == 0;
1198 }
1199 return true;
1200 }
void remove(TreeNode *&root, int x)
Definition: acwing408.cpp:476

引用了 acwing::acwing3786::remove().

被这些函数引用 leetcode::stone_game_ix::TEST().


该类的文档由以下文件生成: