Skip to content

Instantly share code, notes, and snippets.

@trunkslamchest
Created August 30, 2020 15:57
Show Gist options
  • Save trunkslamchest/80a9b8728f1878f0082f64bf4423c3fd to your computer and use it in GitHub Desktop.
Save trunkslamchest/80a9b8728f1878f0082f64bf4423c3fd to your computer and use it in GitHub Desktop.
blog30_tests
Test Case #1:
Input: nums = [4,3,10,9,8]
Output: [10,9]
Explanation: The subsequences [10,9] and [10,8] are minimal
such that the sum of their elements is strictly greater than the sum of elements not included, however,
the subsequence [10,9] has the maximum total sum of its elements.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test Case #2:
Input: nums = [4,4,7,6,7]
Output: [7,7,6]
Explanation: The subsequence [7,7] has the sum of its elements equal to 14
which is not strictly greater than the sum of elements not included (14 = 4 + 4 + 6).
Therefore, the subsequence [7,6,7] is the minimal satisfying the conditions.
Note the subsequence has to returned in non-decreasing order.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test Case #3:
Input: nums = [6]
Output: [6]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment