Created
May 31, 2014 01:56
-
-
Save Cee/efa8b05cbbda42e47ae6 to your computer and use it in GitHub Desktop.
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
public class Solution { | |
public int uniquePaths(int m, int n) { | |
long ret = 1; | |
int a = m - 1, b = n - 1; | |
if ((a == 0) || (b == 0)) return 1; | |
if (a > b){ | |
a = a ^ b; | |
b = a ^ b; | |
a = a ^ b; | |
} | |
for (int i = 1; i <= a; i++){ | |
ret = ret * (a + b + 1 - i) / i; | |
} | |
return (int)(ret); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
数学问题!