leetcode

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

1529.cpp (276B)


      1 class Solution {
      2   public:
      3     int minFlips(const string &target) {
      4         int res = 0, looking = 1;
      5         for (const char c : target) {
      6             if ((c & 1) != looking) continue;
      7             looking = !looking;
      8             res++;
      9         }
     10         return res;
     11     }
     12 };