LeetCode: 1658-Minimum Operations to Reduce X to Zero 解題記錄
題目
You are given an integer array nums
and an integer x
. In one operation, you can either remove the leftmost or the rightmost element from the array nums
and subtract its value from x
. Note that this modifies the array for future operations.