Skip to content

Instantly share code, notes, and snippets.

View icarito's full-sized avatar
🐙

Sebastian Silva icarito

🐙
  • Amazonas Sur
View GitHub Profile
adjhfkjsdhflkajsdhflkajsdf

Find Multiples of a Number

https://www.codewars.com/kata/58ca658cc0d6401f2700045f/train/javascript

En este ejercicio sencillo, construirás un programa que toma un valor, integer, y retorna una lista de sus múltiplos hasta llegar a otro valor, limit. Si limit es un múltipo de integer, entonces debería ser incluído también. Puedes asumir que solo se pasarán números positivos y enteros a la función, sin incluir el 0. El límite siempre será mayor que la base.

Por ejemplo, si los parámetros recibidos hubieran sido (2, 6), entonces la función debería retornar [2, 4, 6], dado que 2, 4 y 6 son múltiplos de 2 hasta el 6.

Bonus extra

function elevatorDistance(array) {
const [lastFloor, ...rest] = array;
if (rest.length <= 1) {
return Math.abs(lastFloor - rest[0]);
}
else {
return Math.abs(lastFloor - rest[0]) + elevatorDistance(rest);
}
}
@icarito
icarito / README.md
Created April 30, 2020 06:50
SCRIPT-8
Step #0: rake aborted!
Step #0: Errno::ENOENT: No such file or directory - bs_fetch:open_current_file:open
Step #0: /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/compile_cache/yaml.rb:51:in `fetch'
Step #0: /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/compile_cache/yaml.rb:51:in `block in install!'
Step #0: /app/config/initializers/load_config.rb:1:in `<main>'
Step #0: /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
Step #0: /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
Step #0: /usr/local/bundle/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `block in load'
Step #0: /usr/local/bundle/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:257:in `load_dependency'
Step #0: /usr/local/bundle/gems/activesupport-5.2.4.2/lib/active_support/dependencies.rb:285:in `load'
@icarito
icarito / README.md
Created April 25, 2020 23:36
SCRIPT-8
5a6
> "baloon.png"
1390a1392
> "drone.png"
1401a1404
> "fontawesome/fonts/fontawesome-webfont.eot"
1404a1408
> "fontawesome/fonts/fontawesome-webfont.ttf"
1405a1410,1412
> "fontawesome/fonts/fontawesome-webfont.woff"
5a6
> "baloon.png"
1390a1392
> "drone.png"
1401a1404
> "fontawesome/fonts/fontawesome-webfont.eot"
1404a1408
> "fontawesome/fonts/fontawesome-webfont.ttf"
1405a1410,1412
> "fontawesome/fonts/fontawesome-webfont.woff"
@icarito
icarito / README.md
Created January 6, 2020 04:39
SCRIPT-8