This file contains 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
function processData(input) { | |
var flag = true; | |
var rows = 8; | |
var str = ''; | |
for(var i=0; i<=rows; i++) { | |
for(j=rows-i; j > 0; j--) { | |
str += ' '; | |
} | |
if (i == 0 && flag) { |
This file contains 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
const fns = [ | |
function () { | |
console.log(1) | |
}, | |
function () { | |
console.log(2) | |
}, | |
function () { | |
console.log(3) | |
} |
This file contains 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
var R = require("ramda"); | |
var sales = [ {id: 1, price: 500}, {id: 2, price: 1500}, {id: 3, price: 750}, {id: 4, price: 1750}, {id: 5, price: 150}, {id: 3, price: 750}, ]; | |
var resultWithoutRamda = sales.filter(sale => sale.price < 1000) | |
.map(sale => sale.price) | |
.sort((a, b) => a-b); | |
console.log(resultWithoutRamda); |
This file contains 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
var R = require("ramda"); | |
// | |
// get top 3 vetted Frontend Developers names, | |
// who completed hackerrank with the score >=90 | |
// ordered by rate: from lower to higher. | |
var hackerrankResults = [ | |
{hackerrank: 90, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, | |
{hackerrank: 20, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, | |
{hackerrank: 100, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, |
This file contains 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
"use strict"; | |
var R = require("ramda"); | |
var hackerrankResults = [ | |
{hackerrank: 90, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, | |
{hackerrank: 20, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, | |
{hackerrank: 100, name: "Maria", category: "Frontend", vetted: true, rate: "1000"}, | |
{hackerrank: 100, name: "Galina", category: "Frontend", vetted: true, rate: "2000"}, | |
{hackerrank: 95, name: "Olga", category: "Frontend", vetted: true, rate: "3000"}, |
This file contains 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
//https://www.hackerrank.com/challenges/circular-array-rotation | |
function processData(input) { | |
var inputSplit = input.split("\n"); | |
var n = Number(inputSplit[0].split(" ")[0]); | |
var k = Number(inputSplit[0].split(" ")[1]); | |
var q = Number(inputSplit[0].split(" ")[2]); | |
var arr = inputSplit[1].split(" ").map(Number); | |
var newArr = (Array(k).fill()).reduce(function(memo, item) { | |
var ele = memo.pop(); |
This file contains 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
// https://www.hackerrank.com/challenges/compare-the-triplets | |
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { |
This file contains 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
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { | |
input_stdin += data; | |
}); |
This file contains 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
// https://www.hackerrank.com/challenges/diagonal-difference | |
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { |
This file contains 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
function flatten(arr) { | |
return arr.reduce(function (acc, item) { | |
if (item instanceof Array) { | |
return acc.concat(flatten(item)) | |
} else { | |
return acc.concat(item) | |
} | |
}, []); | |
} |
OlderNewer