Given four integers a, b, m, n . Find whether pow(a,b) is greater than pow(m,n) or not. Where pow(x,y) denotes x raised to the power y. Output 1 if pow(a,b) is greater, output 0 if pow(m,n) is greater otherwise output -1 if both are equal.
Input:a = 2 , b = 2 , m = 3 , n = 2Output:0Explanation:22 = 4, and 32 = 9. 9>4. So,
the Output 0.
Input:a = 1 , b = 23 , m = 1 , n = 989Output:-1Explanation:Both 123 and 1989 = 1. So,
the Output is -1.
You don't need to read input or print anything. Your task is to complete the function greaterPower() which takes 4 Integers a,b,m and n as input and returns the answer.
Expected Time Complexity: O(max(log(a),log(m)) Expected Auxiliary Space: O(1)