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
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 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
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 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
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 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
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 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
const initTime = (id) => console.time(id) | |
const endTime = (id) => console.timeEnd(id) | |
const testTime = (delay, id) => { | |
initTime(id) | |
setTimeout(() => endTime(id), delay) | |
} | |
testTime(3000, "T0") | |
testTime(2000, "T1") |
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
const arr1 = [ | |
{ val1_1: 1, val1_2: 2, val1_3: 3, val1_4: 4 }, | |
{ val1_5: 5, val1_6: 6, val1_7: 7, val1_8: 8 } | |
]; | |
const arr2 = [ | |
{ val2_1: 1, val2_2: 2, val2_3: 3, val2_4: 4 }, | |
{ val2_5: 5, val2_6: 6, val2_7: 7, val2_8: 8 } | |
].reverse(); |
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
const arr = [1,2,3,4,5,6,7,8,9] | |
const fnMove = (list) => (ele, newPos) => { | |
const _arr = [].concat(list) | |
const arrPos = Array.from({length:2}) | |
arrPos[0] = _arr.indexOf(ele) | |
arrPos[1] = _arr[newPos] | |
_arr[newPos] = ele |
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
const sort = (list) => list.sort((a,b) => a < b) | |
const minus = (a) => (b) => a - b | |
const size = (list) => list.length | |
const obelus = (a) => (b) => Math.floor(a / b) | |
const times = (a) => (b) => a * b | |
const calc = (a) => (b) => minus(a)(times(b)(obelus(a)(b))) | |
const solve = (peoples) => (umbrellas) => { | |
return sort(umbrellas).reduce((acc, cur, i) => { |
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
const solve = (str1) => (str2) => (str1 + str2).split('').reduce((acc, cur, i) => acc.concat(str1.slice(i, i + 1) , str2.slice(i , i + 1)), []).join('') | |
console.log(solve('Carlo')('Enrico')) |