#include <leetcode.h>
◆ PredictTheWinner()
bool leetcode::predict_the_winner::Solution::PredictTheWinner |
( |
vector< int > & |
nums | ) |
|
|
static |
在文件 leetcode.cpp 第 8825 行定义.
8826 const int length = nums.size();
8827 auto dp = vector<int>(length);
8828 for(
int i = 0; i < length; i++) {
8831 for(
int i = length - 2; i >= 0; i--) {
8832 for(
int j = i + 1; j < length; j++) {
8833 dp[j] = max(nums[i] - dp[j], nums[j] - dp[j - 1]);
8836 return dp[length - 1] >= 0;
被这些函数引用 leetcode::predict_the_winner::TEST().
该类的文档由以下文件生成: