#include <leetcode.h>
◆ maxScoreIndices()
vector< int > leetcode::all_divisions_with_the_highest_score_of_a_binary_array::Solution::maxScoreIndices |
( |
vector< int > & |
nums | ) |
|
|
static |
在文件 leetcode.cpp 第 1944 行定义.
1945 const auto n = nums.size();
1946 auto left_0_count = vector<int>();
1947 auto right_1_count = vector<int>();
1948 left_0_count.push_back(0);
1949 right_1_count.push_back(0);
1951 for(
int i = 0; i < n; i++) {
1955 left_0_count.push_back(count);
1958 for(
int i = n - 1; i >= 0; i--) {
1962 right_1_count.push_back(count);
1964 right_1_count = vector(right_1_count.rbegin(), right_1_count.rend());
1966 for(
int i = 0; i <= n; i++) {
1967 maximum = max(maximum, left_0_count[i] + right_1_count[i]);
1969 auto ans = vector<int>();
1970 for(
int i = 0; i <= n; i++) {
1971 if(maximum == left_0_count[i] + right_1_count[i]) {
该类的文档由以下文件生成: