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
/** | |
* Created in 20/06/2017. | |
* Author: William Dias Vargas | |
* Github: @wdiasvargas | |
*/ | |
"use strict"; | |
import memoization from './memoization'; | |
import derivative from './derivative'; | |
import f from './fn'; | |
import x from './x'; |
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
/** | |
* Created by William on 20/06/2017. | |
*/ | |
import fibonacci from './fibonacci'; | |
export default (n = 0) => (m = {}) => (m[n]) ? (m[n]) : (n <= 1) ? (n) :(m[n]) = ((fibonacci(n-1)(m)) + (fibonacci(n-2)(m))); | |
console.info(fibonacci(7)()) | |
// function fibonacci(num, memo) { | |
// memo = memo || {}; | |
// | |
// if (memo[num]) return memo[num]; |
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 isPrime(n) { | |
if (n == 2 || n == 3 || n == 5 || n == 7) { | |
return true; | |
} else if ((n < 2) || (n % 2 == 0)) { | |
return false; | |
} else { | |
for (var i = 3; i <= Math.sqrt(n); i += 2) { | |
if (n % i == 0) | |
return false; | |
} |
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
npm install --save-dev babel-preset-env && echo { "presets": ["env"] } > .babelrc |
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
/** | |
* Write by wdiasvargas on 04/05/17. | |
* www.williamdiasvargas.com.br | |
* | |
**/ | |
'use strict' | |
//STACK com ES6 | |
class Stack { | |
constructor () { | |
this.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
/** | |
* Write by wdiasvargas on 04/05/17. | |
* www.williamdiasvargas.com.br | |
* | |
**/ | |
'use strict' | |
//STACK com ES6 | |
import push from './stack_methods/push' | |
import pop from './stack_methods/pop' | |
import peek from './stack_methods/peek' |
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
/** | |
* Created by William Dias on 29/04/17. | |
* www.williamdiasvargas.com.br | |
*/ | |
'use strict' | |
class Usuario { | |
constructor (login, senha) { | |
this.login = login; | |
this.senha = senha; |
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
values = [82.1467068058,38.4966734016,32.0008188793,96.9622650244,86.8058759993,79.3362306586,58.0055852798,75.8220414787,67.0149545567,36.4044706595,85.3345320643,20.6287894419,81.7456373986,24.4326880876,19.9944876851,80.2303362813,98.6854373061,4.3960766433,22.1212283642,53.1724684800,50.3620960690,11.3724002897,41.0039978225,64.8333473234,15.5894909570,85.3067494504,84.0015994709,91.3425614815,47.3171987992,16.5602177445,86.5891620670,27.3438542203,72.3398157121,18.5367692487,40.5793436922,70.1641373485,59.9469967755,64.6235988325,35.4129698701,90.1449361797,89.5436831889,20.7605480631,72.2822633062,27.9079298572,67.1159466004,68.6223243990,88.5802505560,13.6363037261,24.7355830273,19.7367890419,63.9377755788,75.6711643900,31.9382648930,45.6193707884,43.8147543419,18.2865472284,39.0358874791,6.6626381087,64.3532950055,57.8284906640,69.1947236148,18.9723704594,28.5984494536,86.5579189727,34.9384562133,26.2378601208,97.9248087536,38.6448350638,77.7968509496,77.5877098686,1.4398382678,87.6189498380,47.837622 |
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' | |
/**/ | |
function moda (arr) { | |
return ((arr.sort((a, b) => | |
(arr.filter(v => v === a).length) - (arr.filter(v => v === b).length)) | |
).pop()) | |
} | |
module.exports = moda | |
console.log(moda([1,2,3,4,5])) //amodal nao tem moda(nao deveria aparecer nada) |
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 fatorial(n){ | |
if(n == 0 ) | |
return 1; | |
else{ | |
return n * fatorial(n-1) | |
} | |
} |