## Choose points from two ranges such that no point lies in both the ranges

Given two segments [L1, R1] and [L2, R2], the task is to choose two elements x and y from both the ranges (one from range… Read More »

## Count all Prime Length Palindromic Substrings

Given a string str, the task is to count all the sub-strings of str which are palindromes and their length is prime. Examples: Input: str… Read More »

## Minimum operations of the given type required to make a complete graph

Given N vertex where N is even. Initially there is no edge between any of the vertices. You are allowed to perform operation as illustrated… Read More »

## Code Optimization Technique (logical AND and logical OR)

Logical AND (&&) While using && (logical AND), we must put the condition first whose probability of getting false is high so that compiler doesn’t… Read More »

## Greatest divisor which divides all natural number in range [L, R]

Given two integers L and R, the task is to find the greatest divisor that divides all the natural numbers in the range [L, R].… Read More »

## Find the repeating and the missing number using two equations

Given an array arr[] of size N, each integer from the range [1, N] appears exactly once except A which appears twice and B which… Read More »

## Algorithms | Recurrences | Set 1

Question 1: Which of the following is the value of T3(n) where T3(n) is defined as T3(n) = 5*T3(n-1) – 4*T3(n-2) C1*5n + C2*4n C1… Read More »

## Difference between Recursion and Iteration

A program is called recursive when an entity calls itself. A program is call iterative when there is a loop (or repetition). Example: Program to… Read More »

## Largest perfect square number in an Array

Given an array of n integers. The task is to find the largest number which is a perfect square. Print -1 if there is no… Read More »

## Maximum number of parallelograms that can be made using the given length of line segments

Given N line segments where the length of the ith line segment is . The task is to find the maximum number of parallelograms can… Read More »

## Probability of getting two consecutive heads after choosing a random coin among two different types of coins

Given two coins which have probability of getting heads p% and q% respectively, the task is to determine the probability of getting two consecutive heads… Read More »

## Check whether bitwise OR of N numbers is Even or Odd

Given an array arr[] containing N numbers. The task is to check whether the bitwise-OR of the given N numbers is even or odd. Examples:… Read More »

## Jump Pointer Algorithm

The Jump pointer algorithm is a design technique for parallel algorithms that operate on pointer structures, such as arrays or linked list. This algorithm is… Read More »

## Count pairs (i,j) such that (i+j) is divisible by A and B both

Given n, m, A and B. The task is to count the number of pairs of integers (x, y) such that 1 x n and… Read More »

## Lower and Upper Bound Theory

The Lower and Upper Bound Theory provides a way to find the lowest complexity algorithm to solve a problem. Before understanding the theory, first lets… Read More »