Number of ways of writing N as a sum of 4 squares

Given a number N, the task is to find the number of ways of writing N as a sum of 4 squares. Two representations are… Read More »

Find the Nth Mosaic number

Given an integer N, the task is to find the Nth Mosaic number. A Mosaic number can be expressed as follows: If N = Aa… Read More »

Print first N terms of Lower Wythoff sequence

Given an integer N, the task is to print the first N terms of the Lower Wythoff sequence. Examples: Input: N = 5 Output: 1,… Read More »

Minimum deletions required to make GCD of the array equal to 1

Given an array arr[] of N integers, the task is to find the minimum deletions required to make the GCD of the resulting array elements… Read More »

Find optimal weights which can be used to weigh all the weights in the range [1, X]

Given an integer X, the task is to find an optimal set of weights {w1, w2, w3, …, wn} such that we can weigh/determine all… Read More »

Seating arrangement of N boys sitting around a round table such that two particular boys sit together

There are N boys which are to be seated around a round table. The task is to find the number of ways in which N… Read More »

Find maximum value of the last element after reducing the array with given operations

Given an array arr[] of N elements, you have to perform the following operation on the given array until the array is reduced to a… Read More »

Find Nth smallest number that is divisible by 100 exactly K times

Given two numbers N and K . The task is to find N’th smallest number that is divided by 100 exactly K times. Examples: Input… Read More »

Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides

Given N-sided polygon we need to find the total number of triangles formed by joining the vertices of the given polygon with exactly two sides… Read More »

Find the maximum number of elements divisible by 3

Given an array of size N. The task to find the maximum possible number of elements divisible by 3 that are in the array after… Read More »

Find the Kth smallest element in the sorted generated array

Given an array arr[] of N elements and an integer K, the task is to generate an B[] with the following rules: Copy elements arr[1…N],… Read More »

Number of triangles formed by joining vertices of n-sided polygon with one side common

Given N-sided polygon we need to find the number of triangles formed by joining the vertices of the given polygon with exactly one side being… Read More »

Count pairs with set bits sum equal to K

Given an array arr[] and an integer K, the task is to count the pairs whose sum of set bits is K Examples: Input: arr[]… Read More »

Number of ways to get a given sum with n number of m-faced dices

Given n dices each with m faces, numbered from 1 to m, find the number of ways to get a given sum X. X is… Read More »

Print Lower Hessenberg matrix of order N

Given a positive integer N, the task is to print the Lower Hessenberg matrix of order N which includes any one-digit random positive integer as… Read More »