Skip to content

Instantly share code, notes, and snippets.

@run
Last active August 29, 2015 14:08
Show Gist options
  • Save run/175a9d1431fd219d4db8 to your computer and use it in GitHub Desktop.
Save run/175a9d1431fd219d4db8 to your computer and use it in GitHub Desktop.
leetcode
object pascal {
def main(args : Array[String]) {
println("Pascal triangle")
for (row <- 0 to 10) {
for (col <- 0 to row) {
print(pascal(col, row) + " ")
}
println();
}
}
def pascal(c : Int, r : Int) : Int = {
if (c == 0 ||c == r)
1
else {
pascal(c-1, r-1) + pascal(c, r-1)
}
}
}
int main() {
printf("hello, world");
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment