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)


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