Last active
January 5, 2016 18:22
-
-
Save mCzolko/8d908133b350f1d7a3f0 to your computer and use it in GitHub Desktop.
HackerRank
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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