Basic codes

Practise makes man perfect !

nth number in Fibonacci Series

Solved on: Tuesday 07, 2020

#include<bits/stdc++.h> 
using namespace std; 
  
int fib(int n) 
{ 
    if (n <= 1) 
        return n; 
    return fib(n-1) + fib(n-2); 
} 
  
int main () 
{ 
    int n;
    cin >> n;
    cout << fib(n-1); 
    return 0; 
} 
  

Print Fibonacci Sequence

Solved on: Tuesday 07, 2020

Subarray with given sum

Solved on: Monday 13 April 2020

Sort an array of 0s, 1s and 2s

Solved on: Monday 13 April 2020

Kaprekars Constant Solved on: Aug 7th 2020

Insertion Sort Solved on: Aug 15th 2020

Selection Sort: Solved on Sep 6th 2020

Bubble Sort Solved on: Sep 6th 2020

Insertion Sort Solved on: Sep 7th 2020

Minimum operation to make all elements equal in array Solved on: Sep 7th 2020

Last updated

Was this helpful?