Make Array Zero by Subtracting Equal Amounts
You're provided with a non-negative integer array, nums. Each operation involves:
- Choosing a positive integer x that is less than or equal to the smallest non-zero element in nums.
- Subtracting x from every positive element in nums.
Your task is to determine and print the minimum number of operations required to make every element in nums equal to 0.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)