Skip to content

Instantly share code, notes, and snippets.

@trunkslamchest
Created August 30, 2020 17:40
Show Gist options
  • Save trunkslamchest/b7d8c52e3fa98f8262a15640b8a1f841 to your computer and use it in GitHub Desktop.
Save trunkslamchest/b7d8c52e3fa98f8262a15640b8a1f841 to your computer and use it in GitHub Desktop.
blog30_solution4.js
var minSubsequence = function(nums) {
let sum = nums.reduce((a, b) => a + b )
let subSum = 0
let sub = []
nums.sort((a, b) => a - b)
for(i = nums.length - 1; i >= 0; i--){
// if sum is greater than or equal to subSum
if(sum >= subSum) {
// otherwise
} else {
// break out of the iteration
break
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment