2809. Minimum Time to Make Array Sum At Most x
You are given two 0-indexed integer arrays
nums1
andnums2
of equal length. Every second, for all indices0 <= i < nums1.length
, value ofnums1[i]
is incremented bynums2[i]
. After this is done, you can do the following operation:
- Choose an index
0 <= i < nums1.length
and makenums1[i] = 0
.You are also given an integer
x
.Return the minimum time in which you can make the sum of all elements of
nums1
to be less than or equal tox
, or-1
if this is not possible.
c++
1 | class Solution { |