Basic codes

Practise makes man perfect !

nth number in Fibonacci Seriesarrow-up-right

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 Sequencearrow-up-right

Solved on: Tuesday 07, 2020

Subarray with given sumarrow-up-right

Solved on: Monday 13 April 2020

Sort an array of 0s, 1s and 2sarrow-up-right

Solved on: Monday 13 April 2020

Kaprekars Constantarrow-up-right Solved on: Aug 7th 2020

Insertion Sortarrow-up-right Solved on: Aug 15th 2020

Selection Sort:arrow-up-right Solved on Sep 6th 2020

Bubble Sortarrow-up-right Solved on: Sep 6th 2020

Insertion Sort Solved on: Sep 7th 2020

Minimum operation to make all elements equal in arrayarrow-up-right Solved on: Sep 7th 2020

Last updated