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 hints

Topics

Also asked at 2 companies


More Sprinklr Questions

View all Sprinklr questions