class Solution {
public int minElements(int[] nums, int limit, int goal) {
long sum =0;
for(int i : nums){
sum+=i;
}
if(sum==goal) return 0;
long x = goal - sum;
if(Math.abs(x)<=limit) return 1;
int val = (int) Math.ceil((double)Math.abs(x)/limit);
return val;
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)