leetcode

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

1276.cpp (362B)


      1 class Solution {
      2   public:
      3     vector<int> numOfBurgers(const int tomatoSlices, int const cheeseSlices) const {
      4         if (tomatoSlices % 2) return {};
      5         if (cheeseSlices * 4 < tomatoSlices) return {};
      6         if (cheeseSlices * 2 > tomatoSlices) return {};
      7 
      8         return {tomatoSlices / 2 - cheeseSlices, cheeseSlices * 2 - tomatoSlices / 2};
      9     }
     10 };