Practice Double Modular Exponentiation
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Each variables[i] contains [a,b,c,m]. Return the indices i for which ((a^b mod 10)^c) mod m equals target. The indices may be returned in any order.
Source: Double Modular Exponentiation on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
variables = [[2,3,3,10],[3,3,3,1],[6,1,1,4]], target = 2
Output
[0,2]
# Example 2
Input
variables = [[39,3,1000,1000]], target = 17
Output
[]
Constraints
1 <= variables.length <= 100
variables[i] == [ai, bi, ci, mi]
1 <= ai, bi, ci, mi <= 10^3
0 <= target <= 10^3
Related LeetCode Problems
Practice more problems similar to Double Modular Exponentiation.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.