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
| function processData(input) { | |
| var lines = input.split('\n'); | |
| var tmp = lines[0].split(' ').map(x => parseInt(x)); | |
| var n = tmp[0]; | |
| var m = tmp[1]; | |
| var coins = lines[1].split(' ').map(x => parseInt(x)).slice(0, m); | |
| // sorting coins to decrease number of calls | |
| coins.sort(); | |
| //console.log(n, m, coins); |
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
| /* | |
| https://www.hackerrank.com/challenges/matrix-rotation-algo | |
| You are given a 2D matrix, a, of dimension MxN and a positive integer R. | |
| You have to rotate the matrix R times and print the resultant matrix. | |
| Rotation should be in anti-clockwise direction. | |
| */ | |
| process.stdin.resume(); | |
| process.stdin.setEncoding("ascii"); | |
| _input = ""; |
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
| rem http://www.jayway.com/2014/09/03/creating-self-signed-certificates-with-makecert-exe-for-development/ | |
| makecert.exe ^ | |
| -n "CN=CARoot" ^ | |
| -r ^ | |
| -pe ^ | |
| -a sha512 ^ | |
| -len 4096 ^ | |
| -cy authority ^ | |
| -sv CARoot.pvk ^ |
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
| node --expose-gc --trace-gc --trace-gc-verbose --trace-gc-ignore-scavenger --max-old-space-size=1000 server.js |
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
| function primes(num){ | |
| var result = [2, 3]; | |
| for(var i = 5; i<= num; i+=2){ | |
| if ( result.every( x => i % x ) ) { | |
| result.push(i); | |
| } | |
| } | |
| return result; | |
| } |
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
| Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument. | |
| cid is a 2d array listing available currency. | |
| Return the string "Insufficient Funds" if cash-in-drawer is less than the change due. Return the string "Closed" if cash-in-drawer is equal to the change due. | |
| Otherwise, return change in coin and bills, sorted in highest to lowest order. | |
| // Example cash-in-drawer array: | |
| // [["PENNY", 1.01], |
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
| /* | |
| A number is called a circular prime if it is prime and all of its rotations are primes. | |
| For example the number 197 has two rotations: 971, and 719. | |
| Both of them are prime. | |
| There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. | |
| How many circular primes are there below N? |
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
| 0 info it worked if it ends with ok | |
| 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', | |
| 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', | |
| 1 verbose cli 'install', | |
| 1 verbose cli '-ddd' ] | |
| 2 info using [email protected] | |
| 3 info using [email protected] | |
| 4 silly loadCurrentTree Starting | |
| 5 silly install loadCurrentTree | |
| 6 silly install readLocalPackageData |
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
| "use strict"; | |
| function Graph(){ | |
| this.vertices = {}; | |
| //graph.addVertex('vFrom', {'vTo1': 1, 'vTo2': 1}); | |
| this.addVertex = function(name, edges) { | |
| this.vertices[name] = edges; | |
| } |
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
| /** | |
| * Created by VV on 2/3/2016. | |
| */ | |
| "use strict"; | |
| function PriorityQueue(){ | |
| this._nodes = []; | |
| this.enqueue = function (priority, item){ | |
| this._nodes.push({priority: priority, item: item}); |