Closest Subsequence Sum at Sprinklr
Hard43.2% acceptance
This problem has 87.5% frequency at Sprinklr.
Problem Description
You are given an integer array `nums` and an integer `goal`. You want to choose a subsequence of `nums` such that the sum of its elements is the closest possible to `goal`. That is, if the sum of the subsequence's elements is `sum`, then you want to **minimize the absolute difference** `abs(sum - g...
Read full problem and hintsTopics
Also asked at 2 companies
More Sprinklr Questions
Create Components With Same ValueHardMinimum Edge Weight Equilibrium Queries in a TreeHardNumber of Great PartitionsHardApply Bitwise Operations to Make Strings EqualMediumApply Operations on Array to Maximize Sum of SquaresHard
View all Sprinklr questions