import java.util.*;
class Program {
public static int getNthFib(int n) {
if (n < 2){
return 0;
} else if (n == 2){
return 1;
}
return getNthFib(n-1) + getNthFib(n-2);
}
}
'Algorithms and Data Structures > Coding Practices' 카테고리의 다른 글
LeetCode LinkedList Cycle II (0) | 2022.07.15 |
---|---|
AlgoExpert Product Sum (0) | 2022.07.15 |
Kattis 3D printer (0) | 2022.07.14 |
LeetCode 15. 3Sums (0) | 2022.07.14 |
AlgoExpert Remove Duplicates from LinkedList (0) | 2022.07.14 |