Dashboard Temp Share Shortlinks Frames API

HTMLify

Day 110
Views: 4 | Author: djdj
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Solution {

    /**
     * @param Integer[] $nums
     * @return Integer
     */
    function maximumCount($nums) {
        if(count(array_unique($nums))==1 && $nums[0] === 0) return 0;
        foreach($nums as $n){
            if($n < 0) $c++;
            if($n > 0) $cc++;
        }
        return max($c, $cc);
    }
}