Skip to content

Instantly share code, notes, and snippets.

@kninami
Created October 27, 2016 07:21
Show Gist options
  • Select an option

  • Save kninami/9a7bf232cba0ff1dca51ad23202da86c to your computer and use it in GitHub Desktop.

Select an option

Save kninami/9a7bf232cba0ff1dca51ad23202da86c to your computer and use it in GitHub Desktop.
function solution(A) {
const sum = (A.length + 1) * (A.length + 1 + 1) / 2;
return A.reduceRight((prev, cur) => prev - cur, sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment