https://github.com/letsdeepchat/the-fibonacci-sequence-using-java
https://github.com/letsdeepchat/the-fibonacci-sequence-using-java
acciojob acciojobsolution fibonacci fibonaccisequence java sequence series
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/letsdeepchat/the-fibonacci-sequence-using-java
- Owner: letsdeepchat
- Created: 2021-12-14T17:20:47.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-14T17:22:12.000Z (over 4 years ago)
- Last Synced: 2025-02-12T15:40:45.586Z (about 1 year ago)
- Topics: acciojob, acciojobsolution, fibonacci, fibonaccisequence, java, sequence, series
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The-fibonacci-Sequence-using-Java
The Fibonacci Sequence
The Fibonacci sequence appears in nature all around us, in the arrangement of seeds in a sunflower and the spiral of a nautilus for example.
The Fibonacci sequence begins with fibonacci(0)=0 and fibonacci(1)=1 as its first and second terms. After these first two elements, each subsequent element is equal to the sum of the previous two elements.
Programmatically:
fibonacci(0)=0 fibonacci(1)=1 fibonacci(n)=fibonacci(n-1)+fibonacci(n-2)
Given n, return the nth number in the sequence.
n=5
The Fibonacci sequence to 6 is fs=[0,1,1,2,3,5,8].With zero-based indexing,fs[5]=5.
Problem description
Complete the code in the editor.
Input:
Contains a single integer,n.
Output:
int: the nth element in the Fibonacci sequence
Constraints
0