2869. Minimum Operations to Collect Elements
You are given an array
nums
of positive integers and an integerk
.In one operation, you can remove the last element of the array and add it to your collection.
Return the minimum number of operations needed to collect elements
1, 2, ..., k
.
1 | class Solution { |