You are given an integer array nums of size n and a positive integer k.
An array is said to be capped by value x if every element in it is replaced by min(nums[i], x).
For each integer x in the range 1 to n, determine whether it is possible to select a subsequence from the array capped by x such that the sum of the selected elements equals k.
Return a 0-indexed boolean array answer of size n, where answer[i] is:
• true if it’s possible when using x = i + 1
• false otherwise.
Input: nums = [5, 2, 3, 6], k = 7
Output: [false, false, true, true]
Input: nums = [2, 4, 6, 8, 10], k = 6
Output: [true, true, true, true, true]
Accepted:
Submission: