[
array
]
BinarySearch 0515 Just Average
Problem statement
https://binarysearch.com/problems/Just-Average/
Solution
Just check that s - k * (n - 1)
in our numbers.
Complexity
It is O(n)
for time and space.
Code
class Solution:
def solve(self, nums, k):
n, s = len(nums), sum(nums)
return s - k * (n - 1) in nums