Getting Compile time error

class Solution {
public double myPow(double x, int n) {

    if(n==0)
    return 1 ;
    
    double pnm1 = myPow(x , n-1);
    double pow = x*pnm1 ;
    
    return pow ;
    
}

}

When I am running this code on leetcode I am getting an error "
WARNING: A command line option has enabled the Security Manager
WARNING: The Security Manager is deprecated and will be removed in a future release
java.lang.StackOverflowError
at line 7, Solution.myPow
at line 7, Solution.myPow"

Hey @rahul1402 You are getting stackOverFlow error bcoz the tescases can be very large which will cause to make many recursive calls. So to prevent this you have to use dynamic programming.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.