Skip to content

Instantly share code, notes, and snippets.

@kirantemojo
Last active January 25, 2017 21:09
Show Gist options
  • Save kirantemojo/2c805c44a4b722e40186013470d5ad64 to your computer and use it in GitHub Desktop.
Save kirantemojo/2c805c44a4b722e40186013470d5ad64 to your computer and use it in GitHub Desktop.
Hackerrank - Hand shake - Javascript
/**
* Hackerrank Solution - Handshake
*/
function main() {
var T = parseInt(readLine());
for(var a0 = 0; a0 < T; a0++){
var N = parseInt(readLine());
console.log(Math.floor(N * (N - 1)/2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment