-
Pense em qualquer número de DOIS dígitos, por exemplo 47
-
Subtraia a soma dos algarismos. Ex.: 47 - (4 + 7) = 36
-
Depois some os algarismos resultantes da subtração anterior, adicionando 4. Ex.: 3 + 6 + 4 = 13
-
Multiplique o resultado pelo inverso do número. Ex.: 13 x 31 = 403
-
E por último, multiplique por 3 o resultado anterior. Ex. 403 x 3 = 1209
-
Obs.: Qualquer número de 2 algarismos (entre 10 e 99) terão o mesmo resultado.
-
Não acredita ? Faça o teste !!!!
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 max = (x, y) => x > y ? x : y | |
console.log([1, 2, 3, 4, 5, 6].reduce(max)) |
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 len = x => x.length | |
const maxBy = fn => (x, y) => fn(x) > fn(y) ? x : y | |
console.log(['a', 'ab', 'abc'].reduce(maxBy(len))) |
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
crie uma função chamada MaiorPalavra(str) que recebe um parâmetro do tipo string e retorna a maior palavra. | |
tenha como casos de entrada os exemplos abaixo: | |
"Olá mundo" | |
"Letra após letra" | |
"uma confusa /:cadeia de caracteres:/[ isso não é!!!!!!!~" | |
"uma bonita sequência^&" |
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 Poller = (time, callback) => { | |
const queue = []; | |
const add = op => { | |
queue.push(op) | |
} | |
const exec = () => { | |
callback(queue.shift()) | |
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
Transformar uma string em outra na qual cada letra do alfabeto deve ser a proxima mantendo o resto igual. ex: a -> b, z -> a, f -> g. | |
Após a transformação gerar uma nova string onde toda vogal deve ser maiúscula. | |
exemplos: | |
Input:"hello*3" | |
Output:"Ifmmp*3" | |
Input:"fun times!" |
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 getIn = ([prop, ...props]) => obj => | |
props.length | |
? getIn(props)(obj[prop]) | |
: obj[prop] | |
const fixture = {a: {b: {c: {d: 1}}}} | |
getIn(['a', 'b', 'c', 'd'])(fixture) |
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://repl.it/Gln6/1 | |
const { | |
length: len | |
, toString | |
, split | |
, join | |
, reverse | |
, take | |
, takeLast |
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 { | |
identity, all, range, map, split, compose, toString | |
, splitAt, length: len, pipe, join, filter | |
} = require('ramda') | |
, {pow, floor} = Math | |
, digits = compose(map(Number), split(''), toString) | |
, digitsToNum = compose(Number, join('')) | |
, property = n => { | |
const | |
squared = pow(n, 2) |