Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Anonymous-recursion/Java/anonymous-recursion-1.java
Normal file
10
Task/Anonymous-recursion/Java/anonymous-recursion-1.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
public static long fib(int n) {
|
||||
if (n < 0)
|
||||
throw new IllegalArgumentException("n can not be a negative number");
|
||||
|
||||
return new Object() {
|
||||
private long fibInner(int n) {
|
||||
return (n < 2) ? n : (fibInner(n - 1) + fibInner(n - 2));
|
||||
}
|
||||
}.fibInner(n);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue