/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/com/thealgorithms/recursion/FibonacciSeries.java
21 строка
589 B
Alex Klymenko
Rename `Recursion` package (#6081)
03 ноя 2024, 15:13
Не верифицирован
03 ноя 2024, 15:13
04bfaa8
Код
Авторство
О чём код?
package com.thealgorithms.recursion; /* The Fibonacci series is a sequence of numbers where each number is the sum of the two preceding ones, starting with 0 and 1. NUMBER 0 1 2 3 4 5 6 7 8 9 10 ... FIBONACCI 0 1 1 2 3 5 8 13 21 34 55 ... */ public final class FibonacciSeries { private FibonacciSeries() { throw new UnsupportedOperationException("Utility class"); } public static int fibonacci(int n) { if (n <= 1) { return n; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } }