leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1503.cpp (321B)


0 class Solution {
1 public:
2 int getLastMoment(int n, const vector<int> &left, const vector<int> &right) const {
3 int l = 0, r = 0;
4 if (!left.empty()) l = *max_element(begin(left), end(left));
5 if (!right.empty()) r = n - *min_element(begin(right), end(right));
6 return max(l, r);
7 }
8 };