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 spiralize = function(size) { | |
let spiral = []; | |
for(let i=0;i<size;i++) { | |
spiral[i] = Array(size).fill(0); | |
} | |
let min = 0; | |
let max = size; | |
while (min < max ) { | |
for(let i=min;i<max;i++) { |
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 Primes(){ | |
let primeNumbers = [2]; | |
const first = (n) => { | |
if (primeNumbers.length >= n) return primeNumbers.slice(0, n + 1); | |
let value = primeNumbers[primeNumbers.length - 1] + 1; | |
let isPrime; | |
while (primeNumbers.length < n) { | |
isPrime = true; | |
primeNumbers.some((prime) => { |
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
/* | |
This gist is to show a differnet approach on the merging task. Some | |
conditions might be missing but I just wanted to present a different | |
implementation, adding or editing a constraint is pretty straighforward. | |
*/ | |
'use strict'; | |
const constraint = (passingCondition, consequence) => ({ | |
passed: passingCondition, | |
applyConsequence: consequence |
NewerOlder