Given two large numbers as strings, find if one is the power of another. For Example :
Input : a = "374747", b = "52627712618930723" Output : YES Explanation : 374747^3 = 52627712618930723 Input : a = "2", b = "4099" Output : NO
Prerequisite : Multiply two large numbers represented as string
The approach is simple. First, find smaller of the two strings and then multiply it with itself until it becomes equal to or greater than the larger string. If they are equal, return true, else return false.
Below is the implementation of above approach
- Modulo power for large numbers represented as strings
- Find ways an Integer can be expressed as sum of n-th power of unique natural numbers
- Find the numbers of strings that can be formed after processing Q queries
- Find the sum of power of bit count raised to the power B
- Find power of power under mod of a prime
- Minimum number of sub-strings of a string such that all are power of 5
- Sum of fourth power of first n even natural numbers
- Writing power function for large numbers
- Find whether a given integer is a power of 3 or not
- Find whether a given number is a power of 4 or not
- Program to find whether a no is power of two
- Find value of y mod (2 raised to power x)
- Find sub-string with given power
- Find the super power of a given Number
- Find multiple of x closest to or a ^ b (a raised to power b)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.