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....
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....
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:...
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....
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:...
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:...
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....
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....
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:...
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....
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:...
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....