Created
November 11, 2012 05:37
-
-
Save na2hiro/4053847 to your computer and use it in GitHub Desktop.
逆パスカル数
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 pascal(arr){ | |
console.log(arr); | |
if(arr.length==1) return arr; | |
var newarr = []; | |
for(var i=0; i<arr.length-1; i++){ | |
newarr.push((Number(arr[i])+Number(arr[i+1]))%10) | |
} | |
return pascal(newarr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gistおためし