Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
varun7654 committed Mar 28, 2024
1 parent 9d9921f commit 4ff627e
Show file tree
Hide file tree
Showing 20 changed files with 240 additions and 191 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.0ee2ca10.js"></script><link href="/static/css/main.8b6ee0e0.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.da4ccc7f.js"></script><link href="/static/css/main.6dd50265.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
12 changes: 6 additions & 6 deletions asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.8b6ee0e0.css",
"main.js": "/static/js/main.0ee2ca10.js",
"main.css": "/static/css/main.6dd50265.css",
"main.js": "/static/js/main.da4ccc7f.js",
"static/js/488.a8d036df.chunk.js": "/static/js/488.a8d036df.chunk.js",
"static/js/780.b4e93c13.chunk.js": "/static/js/780.b4e93c13.chunk.js",
"static/js/802.ad7e52f6.chunk.js": "/static/js/802.ad7e52f6.chunk.js",
Expand Down Expand Up @@ -67,14 +67,14 @@
"static/media/KaTeX_Size3-Regular.woff2": "/static/media/KaTeX_Size3-Regular.e1951519f6f0596f7356.woff2",
"static/media/github-mark-white.svg": "/static/media/github-mark-white.ac7f5ce28096dc43a49cbedeabffa77b.svg",
"index.html": "/index.html",
"main.8b6ee0e0.css.map": "/static/css/main.8b6ee0e0.css.map",
"main.0ee2ca10.js.map": "/static/js/main.0ee2ca10.js.map",
"main.6dd50265.css.map": "/static/css/main.6dd50265.css.map",
"main.da4ccc7f.js.map": "/static/js/main.da4ccc7f.js.map",
"488.a8d036df.chunk.js.map": "/static/js/488.a8d036df.chunk.js.map",
"780.b4e93c13.chunk.js.map": "/static/js/780.b4e93c13.chunk.js.map",
"802.ad7e52f6.chunk.js.map": "/static/js/802.ad7e52f6.chunk.js.map"
},
"entrypoints": [
"static/css/main.8b6ee0e0.css",
"static/js/main.0ee2ca10.js"
"static/css/main.6dd50265.css",
"static/js/main.da4ccc7f.js"
]
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.0ee2ca10.js"></script><link href="/static/css/main.8b6ee0e0.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.da4ccc7f.js"></script><link href="/static/css/main.6dd50265.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
2 changes: 1 addition & 1 deletion problem_locations.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"problemName":"Learning to Code","id":"/intro/intro1"},{"problemName":"Constant Functions","id":"/intro/intro2"},{"problemName":"Constant Functions 2","id":"/intro/intro3"},{"problemName":"Multiple Inputs","id":"/intro/intro4"},{"problemName":"Piecewise Functions","id":"/intro/intro5"},{"problemName":"Binary Search Tree Traversal","id":"/medium/BinarySearchTree"},{"problemName":" Merge Sorted Arrays","id":"/medium/MergeS"},{"problemName":"Fibonacci Problem","id":"/template"},{"problemName":"Fibonacci Problem","id":"/test"}]
[{"problemName":"Fibonacci Problem","id":"/fibonacci"},{"problemName":"Learning to Code","id":"/intro/intro1"},{"problemName":"Constant Functions","id":"/intro/intro2"},{"problemName":"Constant Functions 2","id":"/intro/intro3"},{"problemName":"Multiple Inputs","id":"/intro/intro4"},{"problemName":"Piecewise Functions","id":"/intro/intro5"},{"problemName":"Binary Search Tree Traversal","id":"/medium/BinarySearchTree"},{"problemName":" Merge Sorted Arrays","id":"/medium/MergeSort"}]
34 changes: 28 additions & 6 deletions problems/test.md → problems/fibonacci.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@

Write a function that takes in a number `n` and returns the `n`th number in the Fibonacci sequence.

The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones.
The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones. So,

For reference, the 0th and 1st numbers in the Fibonacci sequence are `0` and `1`, respectively.
The sequence starts like this: `0, 1, 1, 2, 3, 5, 8, 13, 21, 34` and so on.
$ f_n = f_{n-1} + f_{n-2} $

For reference, the 0th and 1st numbers in the Fibonacci sequence are `0` and `1`, respectively.
The sequence starts like the following:

$0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...$

# Problem

```javascript
function findNthFibonacci(n) {
// Your code here
// Your code here
}
```

# Solution

There are many ways to solve this problem.

## Solution 1

```javascript
function findNthFibonacci(n) {
if (n <= 1) return n;
Expand All @@ -33,25 +40,29 @@ function findNthFibonacci(n) {
}
```

This is an iterative solution to find the nth Fibonacci number.
This is an iterative solution to find the nth Fibonacci number.
It works by using a loop to calculate the nth Fibonacci number by adding the previous two numbers in the sequence.


# Test Cases

```javascript
findNthFibonacci(0);
```

0

```javascript
findNthFibonacci(1);
```

1

```javascript
findNthFibonacci(2);
```

1

```javascript
findNthFibonacci(3);
```
Expand All @@ -67,49 +78,60 @@ findNthFibonacci(4);
```javascript
findNthFibonacci(5);
```

5

```javascript
findNthFibonacci(6);
```

8

```javascript
findNthFibonacci(7);
```

13

```javascript
findNthFibonacci(8);
```

21

```javascript
findNthFibonacci(9);
```

34

```javascript
findNthFibonacci(10);
```

55

```javascript
findNthFibonacci(11);
```

89

# Hidden Test Cases

```javascript
let num = Math.floor(Math.random() * 1000);
findNthFibonacci(num);
```

repeat = 100

# Next

nothing

# Tags

- Recursion
- Fibonacci
- JavaScript
Expand Down
Loading

0 comments on commit 4ff627e

Please sign in to comment.