Check whether a given Number is Power-Isolated or not
Given a integer N, with prime factorisation n1p1 * n2p2 …… The task is to check if the integer N is power-isolated or not....
read more
Find operations for Array Divisibility by Power of 2
Given an array of size n, the task is to find the minimum number of operations required in the array such that the product of all array elements is divisible by nth power of 2. In one operation, you can select any index i and multiply ai by i, you can perform an operation on a particular index at most 1 time. (Follow 1-based indexing)...
read more
Compute power of power k times % m
Given x, k and m. Compute (xxxx…k)%m, x is in power k times. Given x is always prime and m is greater than x....
read more
Length of longest subarray with product equal to a power of 2
Given an array arr[] consisting of N positive integers, the task is to find the length of the longest subarray having a product of elements of that subarray equal to a perfect power of 2....
read more
Generate an N-length array with sum equal to twice the sum of its absolute difference with same-indexed elements of given array
Given an array arr[] of size N, the task is to construct an array brr[] of size N that satisfies the following conditions:...
read more
Minimize sum of K positive integers with given LCM
Given two positive integers K and X, the task is to find the minimum possible sum of K positive integers ( repetitions allowed ) having LCM X....
read more
Count numbers from range whose prime factors are only 2 and 3 using Arrays | Set 2
Given two positive integers L and R, the task is to count the elements from the range [L, R] whose prime factors are only 2 and 3.Examples:...
read more
Minimize operations to convert N to a power of K by removing or appending any digit
Given a number N, the task is to find the minimum number of operations to convert the given integer into any power of K where at each operation either any of the digits can be deleted or any of the digits can be appended at the back of the integer....
read more
Number of pairs whose product is a power of 2
Given an array arr[] consisting of N integers, the task is to count the total number of pairs of array elements from the given array such that arr[i] * arr[j] is the power of 2....
read more
Count N-digit numbers possible consisting of digits X and Y
Given three integers N, X, and Y, the task is to find the count of N-digit numbers that can be formed using digits 0 to 9 satisfying the following conditions:...
read more
Writing power function for large numbers
We have given two numbers x and n which are base and exponent respectively. Write a function to compute x^n where 1 <= x, n <= 10000 and overflow may happenExamples:...
read more
Count numbers up to N that cannot be expressed as sum of at least two consecutive positive integers
Given a positive integer N, the task is to find the count of integers from the range [1, N] such that the integer cannot be expressed as sum of two or more consecutive positive integers....
read more