LeetCode #2017

Grid Game

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
using ll = long long;
class Solution {
public:
    long long gridGame(vector<vector<int>>& grid) {
        int N = (int)grid[0].size();
        ll top = accumulate(grid[0].begin(), grid[0].end(), 0LL), bottom = 0;
        ll bot = 0;
        ll mn = LLONG_MAX;
        for(int i = 0; i < N; ++i) {
            top -= grid[0][i];
            mn = min(mn, max(top, bot));
            bot += grid[1][i];
        }
        return mn;
    }
};

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.