int minMoves(int* nums, int numsSize){ int count=0,i,min=nums[0]; for(i=1; i<numsSize; i++) if(nums[i] < min) min = nums[i]; for(i=0; i<numsSize; i++) count += nums[i] - min; return count; }
2023-10-31 11:31:34
int minMoves(int* nums, int numsSize){ int count=0,i,min=nums[0]; for(i=1; i<numsSize; i++) if(nums[i] < min) min = nums[i]; for(i=0; i<numsSize; i++) count += nums[i] - min; return count; }