## Program to print first n Fibonacci Numbers | Set 1

Following is simple program to print first n Fibonacci numbers. Examples : Input : n = 3 Output : 1 1 2 Input : n… Read More »

- Must do Math for Competitive Programming
- Product of all Subarrays of an Array
- Perfect Sum Problem
- How is the time complexity of Sieve of Eratosthenes is n*log(log(n))?
- Pi(π) in C++ with Examples
- Check whether a number can be represented as difference of two squares
- Modulo Operator (%) in C/C++ with Examples
- Count of subsets with sum equal to X using Recursion
- Maximum number of unique values in the array after performing given operations
- Count of subarrays having exactly K perfect square numbers
- Sum of GCD of all possible sequences
- Find the numbers from 1 to N that contains exactly k non-zero digits
- Logarithm tricks for Competitive Programming
- Program to calculate Electricity Bill
- Longest sub-array with maximum GCD
- Count of subarrays which start and end with the same element
- Puzzle | Dividing a Square into N smaller squares
- Minimize the maximum difference of adjacent elements after at most K insertions
- Maximum GCD of all subarrays of length at least 2
- Find K distinct positive odd integers with sum N
- Maximum profit by buying and selling a share at most K times | Greedy Approach
- Longest Mountain Subarray
- Expected Number of Trials to get N Consecutive Heads
- Digital Root of a given large integer using Recursion
- Count number of pairs with positive sum in an array
- Program to calculate Percentile of a student based on rank
- Find the minimum number to be added to N to make it a prime number
- Probability of getting K heads in N coin tosses
- Find the K closest points to origin using Priority Queue
- Minimum window size containing atleast P primes in every window of given range

Following is simple program to print first n Fibonacci numbers. Examples : Input : n = 3 Output : 1 1 2 Input : n… Read More »

Area of a circle can simply be evaluated using following formula. Area = pi * r2 where r is radius of circle Recommended: Please solve… Read More »

Finding area using given sides: Examples : Input : a = 5, b = 7, c = 8 Output : Area of a triangle is… Read More »

Factorial of a non-negative integer, is multiplication of all integers smaller than or equal to n. For example factorial of 6 is 6*5*4*3*2*1 which is… Read More »

LCM (Least Common Multiple) of two numbers is the smallest number which can be divided by both numbers. For example LCM of 15 and 20… Read More »

GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that divides both of them. For example GCD of… Read More »

Given two matrices, the task to multiply them. Matrices can either be square or rectangular. Examples: Input : mat1[][] = {{1, 2}, {3, 4}} mat2[][]… Read More »

Given an integer n, write a function that returns count of trailing zeroes in n!. Examples : Input: n = 5 Output: 1 Factorial of… Read More »

Catalan numbers are a sequence of natural numbers that occurs in many interesting counting problems like following. 1) Count the number of expressions containing n… Read More »

Before the advent of QWERTY keyboards, texts and numbers were placed on the same key. For example, 2 has “ABC” if we wanted to write… Read More »

Online Coding Round: Find if a given string contains duplicates Given a BST, find the maximum N elements of the tree Given a BST, convert… Read More »

Given an array arr[] of size n where every element is in range from 0 to n-1. Rearrange the given array so that arr[i] becomes… Read More »

Given two rectangles, find if the given two rectangles overlap or not. Note that a rectangle can be represented by two coordinates, top left and… Read More »

Given two numbers, write a C program to swap the given numbers. Input : x = 10, y = 20; Output : x = 20,… Read More »

Given two variables, x and y, swap two variables without using a third variable. Method 1 (Using Arithmetic Operators) The idea is to get sum… Read More »