Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Forked from dachev/measurable.js
Created June 12, 2011 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save md2perpe/1021993 to your computer and use it in GitHub Desktop.
Save md2perpe/1021993 to your computer and use it in GitHub Desktop.
Is Measurable
// Recursive version
function isMeasurable(target, weights)
{
if (weights.length == 0)
return target == 0;
var first = weights.shift();
return
isMeasurable(target-first, weights) ||
isMeasurable(target+first, weights) ||
isMeasurable(target, weights);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment