Tutorials
Courses
Go Premium
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.0K+ articles
Python
19.6K+ articles
Mathematical
5.1K+ articles
Combinatorial
460+ articles
Competitive Programming
232+ articles
Modular Arithmetic
207+ articles
combinatorics
46+ articles
Algorithms-Divide and Conquer
8+ articles
In-house
+ articles
Binary Exponentiation
11 posts
Recent Articles
Popular Articles
CSES Solutions - Exponentiation
Last Updated: 23 July 2025
Your task is to efficiently calculate values a^b modulo 109+7. Note that in this task we assume that 00=1.Examples:Input: N = 3, queries[][] = {{3, 4}, {2, 8}, {123, 123}}...
read more
Competitive Programming
Picked
number-theory
Binary Exponentiation
CSES Problems
CSES Solutions - Exponentiation II
Last Updated: 23 July 2025
Your task is to efficiently calculate values a^(b^c) modulo 109+7.Note that in this task we assume that 00 = 1.Examples:Input: N = 2, queries[][] = {{3, 7, 1}, {2, 3, 2}}O...
read more
Competitive Programming
Picked
Modular Arithmetic
Binary Exponentiation
CSES Problems
Ways to arrange N balls of K colors with no adjacent same colors
Last Updated: 23 July 2025
Given infinite balls of K distinct colors. Count the number of ways to arrange N balls in a line such that no two adjacent balls are of same color. Since the answer may be...
read more
Mathematical
Combinatorial
DSA
combinatorics
Binary Exponentiation
CSES Solutions - Bit Strings
Last Updated: 23 July 2025
Your task is to calculate the number of bit strings of length N. For example, if N=3, the correct answer is 8, because the possible bit strings are 000, 001, 010, 011, 100...
read more
Competitive Programming
Picked
Binary Exponentiation
CSES Problems
Counting numbers with given digits and digit sum
Last Updated: 23 July 2025
Given a number N, count the numbers X of length exactly N such that the number X and the sum of digits of the number X have digits A and B only in their decimal representa...
read more
Picked
DSA
number-theory
Binary Exponentiation
Counting k-Length Strings with Character C Allowing Repeated Characters
Last Updated: 23 July 2025
Given a string S of length n containing distinct characters and a character C, the task is to count k-length strings that can be formed using characters from the string S,...
read more
DSA
Geeks Premier League 2023
Binary Exponentiation
Counting K-Length Strings with Fixed Character in a Unique String
Last Updated: 23 July 2025
Given a string S of length n containing distinct characters and a character C , the task is to count k-length strings that can be formed using characters from the string S...
read more
DSA
Geeks Premier League 2023
Binary Exponentiation
Apply Given Permutation on Array K times
Last Updated: 23 July 2025
Given two arrays arr[] and P[] of length N and an integer K. The task is to find the final array if permutation P[] is applied on given array arr[] for K times. If we app...
read more
Picked
DSA
Geeks Premier League 2023
Binary Exponentiation
Rearrange Even and Odd Index Elements in K Operations
Last Updated: 23 July 2025
Given an array arr[] of size N (N is even) and a positive integer K, the task is to apply an operation to the array arr[] for K times. Applying the operation once will shi...
read more
DSA
Algorithms-Divide and Conquer
Binary Exponentiation
Number of ways to Color the Boxes
Last Updated: 23 July 2025
Given N boxes (N = 5) aligned in a line, we need to color all the boxes with using K colors such that the length of the longest segment of boxes with same color is equal t...
read more
DSA
Binary Exponentiation
Binary Exponentiation for Competitive Programming
Last Updated: 23 July 2025
In competitive programming, we often need to do a lot of big number calculations fast. Binary exponentiation is like a super shortcut for doing powers and can make program...
read more
Competitive Programming
Modular Arithmetic
Binary Exponentiation
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !