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
<link rel="import" href="../paper-tabs/paper-tabs.html"> | |
<link rel="import" href="../paper-tabs/paper-tab.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; | |
width: 100%; |
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 memo = { | |
0: 1, | |
1: 1 | |
}; | |
function fib(n) { | |
if(memo[n]) return memo[n]; | |
return (memo[n] = fib(n-1) + fib(n-2)); | |
} |
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 memo = { | |
0: 1, | |
1: 1 | |
}; | |
function fib(n) { | |
if(memo[n]) return memo[n]; | |
return (memo[n] = fib(n-1) + fib(n-2)); | |
} |
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 main(str) { | |
var mid = Math.floor(str.length/2); | |
for(var i = 0;i<mid;++i) { | |
if(str[i] !== str[str.length-1-i]) return false; | |
} | |
return true; | |
} | |
/* | |
console.log(main('a')); |
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 main(str) { | |
var mid = str.length>>1; | |
for(var i = 0;i<mid;++i) { | |
if(str[i] !== str[str.length-1-i]) return false; | |
} | |
return true; | |
} | |
console.log(main('anitalavalatina')); | |
console.log(main('a')); |
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 main(str) { | |
var mid = str.length>>1; | |
for(var i = 0;i<mid;++i) { | |
if(str[i] !== str[str.length-1-i]) return false; | |
} | |
return true; | |
} | |
/* | |
console.log(main('anitalavalatina')); |
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 main(str) { | |
str = str.replace(/\s/g,''); | |
var mid = str.length>>1; | |
for(var i = 0;i<mid;++i) { | |
if(str[i] !== str[str.length-1-i]) return false; | |
} | |
return true; | |
} | |
/* |
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 main(str) { | |
var s = ""; | |
for(var i = str.length-1;i>=0;--i)s+=str[i]; | |
return s; | |
} | |
console.log(main('hola')); | |
console.log(main('mundo')); | |
console.log(main('mundo bla')); |
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 main(n) { | |
var sol = 1; | |
while(n > 1) sol*=(n--); | |
return sol; | |
} | |
/* | |
console.log(main(1)); | |
console.log(main(2)); | |
console.log(main(10)); | |
console.log(main(8)); |
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 mapa = {'á':'a','é':'e','í':'i','ó':'o','ú':'u','ñ':'n'}; | |
function main(str) { | |
var sol = ''; | |
for(var i = 0;i<str.length;++i) { | |
var curr = str[i].toLowerCase(); | |
curr = (mapa[curr] || curr ); | |
if(isAscii(curr)) { | |
sol+=curr; | |
} else { | |
if(sol[sol.length-1] !== '-') |
OlderNewer