You are given a non-negative integer array nums. In one operation, you must:


	Choose a positive integer x such that x is less than or equal to the smallest non-zero element in nums.
	Subtract x from every positive element in nums.


Return the minimum number of operations to make every element in nums equal to 0.

&nbsp;
Example 1:

Input: nums = [1,5,0,3,5]
Output: 3
Explanation:
In the first operation, choose x = 1. Now, nums = [0,4,0,2,4].
In the second operation, choose x = 2. Now, nums = [0,2,0,0,2].
In the third operation, choose x = 2. Now, nums = [0,0,0,0,0].


Example 2:

Input: nums = [0]
Output: 0
Explanation: Each element in nums is already 0 so no operations are needed.


&nbsp;
Constraints:


	1 &lt;= nums.length &lt;= 100
	0 &lt;= nums[i] &lt;= 100


class Solution:
    def minimumOperations(self, nums: List[int]) -> int:
        return len(set(nums) - {0})
class Solution {
    public int minimumOperations(int[] nums) {
        Set<Integer> s = new HashSet<>();
        int result = 0;
        if(nums[0] == 0 && nums.length == 1){
            return 0;
        }
        else{
        for (int num : nums) {
            s.add(num);
        }
        for (int num : nums) {
            s.remove(0);
        }
        result = s.size();;
        }
        return result;
    }
}
class Solution {
public:
    int minimumOperations(vector<int>& nums) {
        priority_queue <int, vector<int>, greater<int> > pq;
        
        for(int i=0;i<nums.size();i++)
            pq.push(nums[i]);
        
        int curr_min=0;
        int count=0;
        
        while(!pq.empty()){
            if(pq.top()==0)pq.pop();
            else{
                int top=pq.top()-curr_min;
                if(top!=0){
                    curr_min+=top;
                    count++;
                }
                pq.pop();
            }
        }
        return count;
    }
};
var minimumOperations = function(nums) {
    let k = new Set(nums) // convert array to set; [...nums] is destructuring syntax
    return k.has(0) ? k.size-1 : k.size; // we dont need 0, hence if zero exists return size-1
};
Make Array Zero by Subtracting Equal Amounts