## Count of elements which are second smallest among three consecutive elements

Given a permutation P of first N natural numbers. The task is to find the number of elements Pi such that Pi is second smallest… Read More »

## Increasing permutation of first N natural numbers

Given a permutation {P1, P2, P3, ….. PN) of first N natural numbers. The task is to check if it is possible to make the… Read More »

## Maximum LCM among all pairs (i, j) of first N natural numbers

Given a positive integer N > 1, the task is to find the maximum LCM among all the pairs (i, j) such that i <… Read More »

## Count number of ways to arrange first N numbers

Count number of ways to arrange the first N natural numbers in a line such that the left-most number is always 1 and no two… Read More »

## Find the permutation of first N natural numbers such that sum of i % Pi is maximum possible

Given a number N. The task is to find the permutation P of first N natural numbers such that sum of i % Pi is… Read More »

## Repeated sum of first N natural numbers

Given two integers N and K, the task is to find the sum of first N natural numbers then update N as the previously calculated… Read More »

## Difference between Sum of Cubes and Sum of First N Natural Numbers

Given an integer N, find the absolute difference between sum of the cubes of first N natural numbers and the sum of first N natural… Read More »

## Divide first N natural numbers into 3 equal sum subsets

Given an integer N, the task is to check whether the elements from the range [1, N] can be divided into three non-empty equal sum… Read More »

## Sum of all natural numbers from L to R ( for large values of L and R )

Given two very large numbers L and R where L ≤ R, the task is to compute the sum of all the natural numbers from… Read More »

## Find permutation with maximum remainder Sum

Given an integer N, the task is to find a permutation of the integers from 1 to N such that is maximum. Examples: Input: N… Read More »

## Check if it is possible to redistribute the Array

Given an array arr[] of N integers, the task is to check if it is possible to redistribute the array such that for every 1… Read More »

## Partition first N natural number into two sets such that their sum is not coprime

Given an integer N, the task is to partition the first N natural numbers in two non-empty sets such that the sum of these set… Read More »

## Count Distinct Rectangles in N*N Chessboard

Given a N x N Chessboard. The task is to count distinct rectangles from the chessboard. For example, if the input is 8 then the… Read More »

## Maximum number of people that can be killed with strength P

There are infinite people standing in a row, indexed from 1. A person having index i has strength of i2. You have strength P and… Read More »