Courses
Tutorials
Interview Prep
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.4K+ articles
Misc
7.7K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Bit Magic
821+ articles
number-theory
424+ articles
maths-power
181+ articles
factorial
141+ articles
base-conversion
93+ articles
maths-log
27 posts
Recent Articles
Popular Articles
Introduction to Logarithm
Last Updated: 21 April 2026
Logarithm is a mathematical function that represents the exponent to which a fixed number, known as the base, must be raised to produce a given number. In other words, it ...
read more
Mathematics
School Learning
maths-log
Maths
Logarithms
Count bases which contains a set bit as the Most Significant Bit in the representation of N
Last Updated: 23 July 2025
Given a positive integer N, the task is to count the number of different bases in which, when N is represented, the most significant bit of N is a found to be a set bit.Ex...
read more
Misc
Bit Magic
Mathematical
DSA
base-conversion
maths-log
Find the sum of all array elements that are equidistant from two consecutive powers of 2
Last Updated: 23 July 2025
Given an array arr[] consisting of N integers, the task is to find the sum of array elements that are equidistant from the two consecutive powers of 2.Examples:Input: arr[...
read more
Mathematical
DSA
Arrays
maths-log
maths-power
Modify string by sorting characters after removal of characters whose frequency is not equal to power of 2
Last Updated: 23 July 2025
Given a string S consisting of N lowercase alphabets, the task is to remove the characters from the string whose frequency is not a power of 2 and then sort the string in ...
read more
Strings
Hash
DSA
frequency-counting
maths-log
maths-power
Find the absolute difference between the nearest powers of two given integers for every array element
Last Updated: 23 July 2025
Given an array arr[] consisting of N positive integers and two positive integers A and B, the task is to replace each array element with the absolute difference of the nea...
read more
Mathematical
DSA
Arrays
maths-log
Print all array elements having frequencies equal to powers of K in ascending order
Last Updated: 23 July 2025
Given an array arr[] consisting of N integers and a positive integer K, the task is to find the array elements having frequencies in the power of K i.e., K1, K2, K3, and s...
read more
Mathematical
DSA
Arrays
maths-log
Nearest smaller power of 2 for every digit of a number
Last Updated: 23 July 2025
Given an integer num, the task for every digit of the number is to find the highest power of 2 not exceeding that digit.Examples:Input: num = 4317Output: 4214Explanation:T...
read more
Mathematical
DSA
maths-log
maths-power
Count numbers up to N that cannot be expressed as sum of at least two consecutive positive integers
Last Updated: 23 July 2025
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 pos...
read more
Misc
Bit Magic
Mathematical
DSA
Numbers
maths-log
maths-power
Find the nearest power of 2 for every array element
Last Updated: 23 July 2025
Given an array arr[] of size N, the task is to print the nearest power of 2 for each array element.Note: If there happens to be two nearest powers of 2, consider the large...
read more
Mathematical
DSA
Arrays
maths-log
maths-power
Count of N digit Numbers whose sum of every K consecutive digits is equal | Set 2
Last Updated: 15 July 2025
Given two integers N and K, the task is to find the count of all possible N-digit numbers having sum of every K consecutive digits of the number are equal.Examples:Input: ...
read more
Misc
Greedy
Mathematical
DSA
number-digits
Numbers
maths-log
maths-power
Logarithm tricks for Competitive Programming
Last Updated: 12 July 2025
Logarithm: is the inverse function of the exponentiation which means the logarithm value of a given number x is the exponent to another number.log_b(x) = y, \to b^{y} = xB...
read more
DSA
maths-log
Find most significant bit of a number X in base Y
Last Updated: 12 July 2025
Given two positive integers X and Y, the task is to find the MSB of X, in the given base Y.Examples:Input: X = 55, Y = 3Output: 2Explanation:55 is 2001 in base 3 with firs...
read more
Mathematical
DSA
base-conversion
maths-log
maths-power
Program to compute log a to any base b (logb a)
Last Updated: 12 July 2025
Given two integers a and b, the task is to find the log of a to any base b, i.e. logb a.Examples:Input: a = 3, b = 2Output: 1Input: a = 256, b = 4Output: 4Recommended: Ple...
read more
DSA
maths-log
Highest power of 2 less than or equal to given Integer
Last Updated: 12 July 2025
Given an integer N, the task is to find the highest power of 2 that is smaller than or equal to N.Examples:Input: N = 9Output: 8Explanation:Highest power of 2 less than 9 ...
read more
DSA
maths-log
maths-power
Larger of a^b or b^a (a raised to power b or b raised to power a)
Last Updated: 11 July 2025
Given two numbers$a and b$, find which is greatera^b or \, b^a.Ifa^b b^a, print a^b is greaterIfa^b b^a, print b^a is greaterIfa^b = b^a, print Both are equalExamples:In...
read more
Mathematical
DSA
maths-log
maths-power
1
2