Skip to content

Commit

Permalink
Solved Time Error
Browse files Browse the repository at this point in the history
  • Loading branch information
mr_jj committed Mar 5, 2022
1 parent aef2eae commit f4c44bc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions 2.Conditionals and Loops/Nth Fibonacci number.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@
"n=int(input())\n",
"print(Fibonacci(n))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Use This To Solve Time Exceed Error\n",
"n = int(input())\n",
"a = 0\n",
"b = 1\n",
"c = -1\n",
"for i in range(n) :\n",
" c = a + b\n",
" a = b\n",
" b = c \n",
"print(a)"
]
}
],
"metadata": {
Expand Down

0 comments on commit f4c44bc

Please sign in to comment.