Number of elements with even factors in the given range

Given a range [n, m], the task is to find the number of elements that have even number of factors in the given range (n… Read More »

Smallest perfect square divisible by all elements of an array

Given an array arr[], the task is to find the smallest perfect square which is divisible by all the elements of the given array. Examples:… Read More »

Check if a number is perfect square without finding square root

We need to check whether a number is a perfect square or not without finding its square root. Examples: Input : n = 36 Output… Read More »

Count numbers upto N which are both perfect square and perfect cube

Given a number N. The task is to count total numbers under N which are both perfect square and cube of some integers. Examples: Input:… Read More »

Closest perfect square and its distance

Given a positive integer . The task is to find the perfect square number closest to N and steps required to reach this number from… Read More »

Check if the sum of perfect squares in an array is divisible by x

Given an array arr[] and an integer x, the task is to check whether the sum of all the perfect squares from the array is… Read More »

Largest Divisor of a Number not divisible by a perfect square

Given a positive integer N. Find the largest divisor of the given number that is not divisible by a perfect square greater than 1. Examples:… Read More »

Count number of triplets (a, b, c) such that a^2 + b^2 = c^2 and 1 <= a <= b <= c <= n

Given an integer N, the task is to count the number of triplets (a, b, c) such that a2 + b2 = c2 and 1… Read More »

Count of pairs in an array whose sum is a perfect square

Given an array of distinct elements, the task is to find the total number of two element pairs from the array whose sum is a… 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 »

Sort perfect squares in an array at their relative positions

Given an integer array , the task is to sort only the elements which are perfect squares at their relative positions in the array (positions… Read More »

Largest sub-array whose all elements are perfect squares

Given an array of integer elements, the task is to find the length of the largest sub-array of such that all the elements of the… Read More »

Count number less than N which are product of perfect squares

Given an Integer N. The task is count numbers P less than N such that P is a product of two distinct perfect squares. Examples:… Read More »

Largest factor of a given number which is a perfect square

Given a number . The task is to find the largest factor of that number which is a perfect square. Examples: Input : N =… Read More »

Count pairs (a, b) whose sum of squares is N (a^2 + b^2 = N)

Given a number N, the task is to count all ‘a’ and ‘b’ that satisfy the condition a^2 + b^2 = N. Note:- (a, b)… Read More »