diff --git a/src/dynamicprogramming/FibonacciSeries.java b/src/dynamicprogramming/FibonacciSeries.java index 9c766f9..6fd1adf 100644 --- a/src/dynamicprogramming/FibonacciSeries.java +++ b/src/dynamicprogramming/FibonacciSeries.java @@ -29,7 +29,11 @@ public static int[] getFibonacciNumbers(int n) { return result; } - + public int fib(int n) { + if(n < 2) return n; + return fib(n - 1) + fib(n - 2); + } // Writting better Solution + public static void main(String[] args) { int n = 10;