Saturday, 4 Dec 2021
Category: maths-perfect-square

Given an array arr[](1-based indexing) consisting of N integers, the task is to find the last element remaining element after repeated removal of array element at perfect square indices.Examples:Input: arr[] = {1, 2, 3, 4, 5}Output: 5Explanation:Following the removal of array element at perfect square indices that are performed:Removing array elements at indices 1 and […]

Given an array arr[] consisting of N positive integers, the task is to check if the product of elements of every subsequence of the given array arr[] is a perfect square or not. If found to be true, then print Yes. Otherwise, print No.Examples:Input: arr[] = {1, 4, 100}Output: YesExplanation:Following are the subsequences of the […]

Check if a number can be represented as a sum of a Prime Number and a Perfect SquareGiven a positive integer N, the task is to check if N can be represented as a sum of a Prime Number and a Perfect Square or not. If it is possible to represent N in required form, […]

Find the nearest odd and even perfect squares of odd and even array elements respectively Given an array arr[ ] of size N, the task for each array element is to print the nearest perfect square having same parity. Examples: Input: arr[ ] = {6, 3, 2, 15}Output: 4 1 4 9Explanation:The nearest even perfect […]