[
array
greedy
]
BinarySearch 0873 Append List to Sum Target
Problem statement
https://binarysearch.com/problems/Append-List-to-Sum-Target/
Solution
Evaluate sum of numbers and target and find gap.
Complexity
It is O(n)
for time and space.
Code
class Solution:
def solve(self, nums, k, target):
return (abs(sum(nums) - target) + k - 1)//k