leetcode

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

1822.cpp (235B)


      1 class Solution {
      2   public:
      3     int arraySign(vector<int> &nums) {
      4         int sign = 1;
      5         for (auto num : nums) {
      6             if (num == 0) return 0;
      7             if (num < 0) sign = -sign;
      8         }
      9         return sign;
     10     }
     11 };