Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
215 B
1
Indexable
Never
   private static int fibonacci(int n) {
        if (n == 1 | n == 2) {
            return 1;
        }
        if (n == 0) {
            return 0;
        }
        return fibonacci(n - 1) + fibonacci(n - 2);
    }