leetcode

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

1375.cpp (247B)


      1 class Solution {
      2   public:
      3     int numTimesAllBlue(const vector<int> &flips) {
      4         int right = 0, res = 0;
      5         for (int i = 0; i < flips.size(); ++i)
      6             res += (right = max(right, flips[i])) == i + 1;
      7         return res;
      8     }
      9 };