Check if a number can be represented as sum of two consecutive perfect cubes
Given an integer N, the task is to check if this number can be represented as the sum of two consecutive perfect cubes or not....
read more
C Program to check whether a number is a Perfect Cube or not
Given a number N, the task is to write C program to check if the given number is perfect cube or not....
read more
Fast Exponentiation using Bit Manipulation
Given two integers A and N, the task is to calculate A raised to power N (i.e. AN)....
read more
Count of pairs whose bitwise AND is a power of 2
Given an array arr[] of N positive integers. The task is to find the number of pairs whose Bitwise AND value is a power of 2.Examples:...
read more
Count number of binary strings of length N having only 0’s and 1’s
Given an integer N, the task is to count the number of binary strings of length N having only 0’s and 1’s. Note: Since the count can be very large, return the answer modulo 10^9+7....
read more
Sum of the series 1^1 + 2^2 + 3^3 + ….. + n^n using recursion
Given an integer n, the task is to find the sum of the series 11 + 22 + 33 + ….. + nn using recursion....
read more
Ways to paint N paintings such that adjacent paintings don’t have same colors
Given two integers n and m, where n represent some paintings numbered from 1 to n and m represent some colours 1 to m with unlimited amount. The task is to find the number of ways to paint the paintings such that no two consecutive paintings have the same colors.Note: Answer must be calculated in modulo 10^9 +7 as answer can be very large. Examples:...
read more
Check if a number can be expressed as x^y (x raised to power y)
Given a positive integer n, find if it can be expressed as xy where y > 1 and x > 0. x and y both are integers....
read more
Smallest power of 2 greater than or equal to n
Write a function that, for a given no n, finds a number p which is greater than or equal to n and is the smallest power of 2....
read more
Write program to calculate pow(x, n)
Given two integers x and n, write a function to compute xn. We may assume that x and n are small and overflow doesn’t happen....
read more
Elements of Array which can be expressed as power of prime numbers
Given an array arr[] of size N, the task is to print all the elements of the Array which can be expressed as power of a prime number....
read more
Minimize steps to change N to power of 2 by deleting or appending any digit
Given an integer N, the task is to find the minimum number of steps required to change the number N to a perfect power of 2 using the following steps:...
read more