docs: fix typos
parent
9a74c3e857
commit
d34acc78b0
|
@ -1,5 +1,5 @@
|
|||
# Fibonacci Number
|
||||
Fibonacci numbers form a Fibonacci sequence where given any number (excluding first 2 terms) is a sum of its two preceding numbers. Usually, the sequence is either start with 0 and 1 or 1 and 1. Below is a Fibonacci sequnce starting from 0 and 1:
|
||||
Fibonacci numbers form a Fibonacci sequence where given any number (excluding first 2 terms) is a sum of its two preceding numbers. Usually, the sequence is either start with 0 and 1 or 1 and 1. Below is a Fibonacci sequence starting from 0 and 1:
|
||||
|
||||
$$
|
||||
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, \dots
|
||||
|
|
|
@ -4,8 +4,8 @@ A factorial of number 4 is calculated as:
|
|||
4 X 3 X 2 X 1 = 24
|
||||
|
||||
Approach: Calculating factorial using for loop.
|
||||
Declaring the f varialbe to 1 (not initialising it to zero because any number multiplied by 0 will be 0)
|
||||
Multiplying the f variable to 1,2,3...n and storing it in the f varialbe.
|
||||
Declaring the f variable to 1 (not initialising it to zero because any number multiplied by 0 will be 0)
|
||||
Multiplying the f variable to 1,2,3...n and storing it in the f variable.
|
||||
The same factorial can be calculated using while loop, recursion.
|
||||
|
||||
Time Complexity: O(number)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Description: Program to print the first uppercase letter in a string
|
||||
|
||||
Approach: Use a varialbe to iterate over the string
|
||||
Approach: Use a variable to iterate over the string
|
||||
Increment the iterator by 1 at every recursive call
|
||||
If the value of iterator reaches till the length of the string, return '\0
|
||||
|
||||
|
|
Loading…
Reference in New Issue