Skip to content

Instantly share code, notes, and snippets.

@mCzolko
Last active January 5, 2016 18:22
Show Gist options
  • Save mCzolko/8d908133b350f1d7a3f0 to your computer and use it in GitHub Desktop.
Save mCzolko/8d908133b350f1d7a3f0 to your computer and use it in GitHub Desktop.
HackerRank
// Solution for:
// Simple Array Sum
// A Very Big Sum
function main() {
var n = parseInt(readLine());
arr = readLine().split(' ');
console.log(arr.map(Number).slice(0, n).reduce( (a, b) => a + b ));
}
// Staircase
function main() {
var n = parseInt(readLine());
for (var i = 0; i < n; i++) {
var level = '';
for (var y = n - 1; 0 <= y ; y--) {
if (y > i) {
level += ' ';
} else {
level += '#';
}
}
console.log(level);
}
}
// Pangrams
function processData(input) {
input = input.toLowerCase().split('');
var chars = new Array();
input.forEach(function (char) {
if (char != ' ' && chars.indexOf(char) == -1) {
chars.push(char);
}
});
if(chars.length == 26) {
console.log('pangram');
} else {
console.log('not pangram');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment