Replace array elements that contains K as a digit with the nearest power of K
Given an array arr[] of size N and an integer K, the task is to replace every array element consisting of K as a digit, with its nearest power of K. Note: If there happen to be two nearest powers then take the greater one....
read more
Find an integral solution of the non-linear equation 2X + 5Y = N
Given an integer N representing a non-linear equation of the form 2X + 5Y = N, the task is to find an integral pair (X, Y) that satisfies the given equation. If multiple solutions exist, then print any one of them. Otherwise, print -1....
read more
Represent N as the sum of exactly K powers of two | Set 3
Given two integers N and K, the task is to find whether it is possible to represent N as the sum of exactly K powers of 2. If possible, then print K positive integers such that they are powers of 2 and their sum is exactly equal to N. Otherwise, print “Impossible”. If multiple answers exist, print any....
read more
Find the multiple of x which is closest to a^b
Given three integers a, b, and x, the task is to get the multiple of x which is closest to ab....
read more
Count of integers up to N which represent a Binary number
Given an integer N, the task is to count every number i from 1 to N (both inclusive) such that i is a binary representation of some integer where N can be any value within the range[1, 109]...
read more
Total number of subsets in which the product of the elements is even
Given an array arr[] of integer elements, the task is to find the total number of sub-sets of arr[] in which the product of the elements is even....
read more
Minimize count of given operations required to be performed to make all array elements equal to 1
Given an array, arr[] consisting of N positive integers, the task is to make all array elements equal to 1 by performing the following operations minimum number of times:...
read more
Count of unique subsequences from given number which are power of 2
Given a string S of size N and containing digits in the range [0-9], the task is to print the count of all the unique subsequences of a string that are the power of 2....
read more
Minimum removals in a number to be divisible by 10 power raised to K
Given two positive integers N and K. Find the minimum number of digits that can be removed from the number N such that after removals the number is divisible by 10K or print -1 if it is impossible.Examples:...
read more
Generate an N-digit number made up of 1 or 2 only which is divisible by 2N
Given an integer N, the task is to generate an N-digit number which is comprising only of digits 1 or 2 and is divisible by 2N....
read more
Check if a number can be expressed as sum of two Perfect powers
Given a positive number N, the task is to check whether the given number N can be expressed in the form of ax + by where x and y > 1 and a and b > 0. If N can be expressed in the given form then print true otherwise print false....
read more
Hamming code Implementation in C++ with receiver side verification of code
Hamming code is an error-correcting code used for detecting and correcting errors in data transmission. It adds redundant bits to the data being transmitted which can be used to detect and correct errors that may occur during transmission. Developed by Richard W. Hamming in the 1950s, it is widely used in applications where reliable data transmission is critical, such as computer networks and telecommunication systems....
read more