├── README.md
├── index.html
├── pro.css
└── pro.js
/README.md:
--------------------------------------------------------------------------------
1 | # 🛰 online
2 | https://Ahmed-Aoulad-Amar.github.io/-2D-fibonacci-number/
3 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | fibonacci number
7 |
8 |
9 |
10 | grid trave 2D using memoization Algorithmic
11 |
12 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/pro.css:
--------------------------------------------------------------------------------
1 | * {
2 | padding: 0;
3 | margin: 0;
4 | }
5 | body{
6 | background-color: #1aaee9;
7 | }
8 | main {
9 | display: flex;
10 | flex-direction: column;
11 | margin: auto;
12 | width: 60%;
13 | border: 3px solid #04ffd5;
14 | padding: 100px;
15 | margin-top: 20vh;
16 | text-align: center;
17 | font-family: cursive;
18 | color: #fff;
19 | }
20 | h1{
21 | padding-bottom: 100px;
22 | }
23 | .p{
24 | color: #ffe604;
25 |
26 | }
27 | #addp{
28 | color: #ff0505fb;
29 | font-size: 40px;
30 | background-color: #1aaee9;
31 | margin: 0;
32 | padding: 0;
33 | border-radius: 1%;
34 | }
35 | input{
36 | width: 50px;
37 | height: 30px;
38 | }
39 | button{
40 | width: 50px;
41 | height: 30px;
42 | border: none;
43 | background: #0447ff81;
44 | color: #fff;
45 | }
--------------------------------------------------------------------------------
/pro.js:
--------------------------------------------------------------------------------
1 | var inp = document.getElementById("input");
2 | var inp2 = document.getElementById("input2");
3 | const btn = document.getElementById("btn");
4 | btn.addEventListener("click", (e) => {
5 | e.preventDefault();
6 | var x = inp.value;
7 | var y = inp2.value;
8 | var gridTraveler = (m, n, memoization = {}) => {
9 | const key = m + ',' + n;
10 | if (key in memoization) return memoization[key];
11 | if (m === 1 && n === 1) return 1;
12 | if (m === 0 || n === 0) return 0;
13 | memoization[key] = gridTraveler(m - 1, n, memoization) + gridTraveler(m, n - 1, memoization);
14 | return memoization[key];
15 | };
16 |
17 | var add = document.getElementById("addp");
18 | add.innerHTML = `
19 | grid travel memoization number is
20 | ${gridTraveler(x, y)}
21 | `;
22 | });
23 | // it gonn work intli 1.3069892237633987e+308
24 | /* more then that = Error cose
25 | that result number it more then js top number*/
26 |
--------------------------------------------------------------------------------