Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- typedef long long ll;
- public:
- long long numberOfWeeks(vector<int>& m) {
- ll maxElement = *max_element(m.begin(), m.end());
- ll sum = accumulate(m.begin(), m.end(), 0LL);
- return min(sum, 2*(sum-maxElement)+1);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment