Skip to content

Instantly share code, notes, and snippets.

@victormier
Created March 20, 2014 18:53
Show Gist options
  • Save victormier/9671147 to your computer and use it in GitHub Desktop.
Save victormier/9671147 to your computer and use it in GitHub Desktop.
Codewars: Largest Difference in Increasing Indexes
var largestDifference = function(data) {
var diff = data.length - 1,
i;
while(diff > 0) {
for(i = 0; i + diff < data.length; i++) {
if (data[i] <= data[i + diff]) {
return diff;
}
}
diff--;
}
return 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment