This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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%; |
NewerOlder