Find the power of K nearest to N
Given two integers N & K. The task is to find the nearest power of K for the integer N. If there are two nearest powers, consider the larger one....
read more
Check if digit cube limit of an integer arrives at fixed point or a limit cycle
Given an integer N, the task is to check if the Digit Cube limit of an integer arrives at a fixed point or in a limit cycle....
read more
Minimize steps to create given Array by adding powers of 2
Given an array A[] having N positive integers, the task is to find the minimum number of steps to build this array from an initial array of size N having all 0s following the below operations:...
read more
Sort array of strings after sorting each string after removing characters whose frequencies are not a powers of 2
Given an array arr[] consisting of N strings, the task is to sort the array in ascending order after modifying each string by removing all characters that are not perfect power of 2 and then sort the modified string in decreasing order....
read more
Count of elements which cannot form any pair whose sum is power of 2
Given an array arr[] of length N, the task is to print the number of array elements that cannot form a pair with any other array element whose sum is a power of two.Examples:...
read more
Minimum steps required to rearrange given array to a power sequence of 2
Given an array arr[] consisting of N positive integers, the task is to find the minimum steps required to make the given array of integers into a sequence of powers of 2 by the following operations:...
read more
Number of Binary Search Trees of height H consisting of H+1 nodes
Given a positive integer H, the task is to find the number of possible Binary Search Trees of height H consisting of the first (H + 1) natural numbers as the node values. Since the count can be very large, print it to modulo 109 + 7....
read more
Count of elements which are power of 2 in a given range subarray for Q queries
Given an array arr[] consisting of N positive numbers and Q queries of the form [L, R], the task is to find the number of elements which are a power of two in a subarray [L, R] for each query....
read more
Find number of pairs (x, y) in an Array such that x^y > y^x | Set 2
Given two arrays X[] and Y[] of positive integers, find the number of pairs such that x^y > y^x where x is an element from X[] and y is an element from Y[].Examples:...
read more
Number of Antisymmetric Relations on a set of N elements
Given a positive integer N, the task is to find the number of Antisymmetric Relations on the given set of N elements.  Since the number of relations can be very large, so print it modulo 109+7....
read more
Solving Homogeneous Recurrence Equations Using Polynomial Reduction
A recurrence relation is an equation that recursively defines a sequence or multidimensional array of values, once one or more initial terms are given; each further term of the sequence or array is defined as a function of the preceding terms. Below are the steps required to solve a recurrence equation using the polynomial reduction method:...
read more
Number of pairs whose sum is a power of 2 | Set 2
Given an array arr[] consisting of N integers, the task is to count the maximum number of pairs (arr[i], arr[j]) such that arr[i] + arr[j] is a power of 2....
read more