openAI write codes. Tried one example:

回答: 我也有帖子,不公平青青的山2023-02-18 12:12:14

/*
Write a Java function that recursively computes the power of an integer. The method looks like: public static int power(int base, int exp)
*/

The function is:

上面是我输入的要求。下面是openAI Codex 的回复, 100分!

 

 


public static int power(int base, int exp) {
    if (exp == 0) {
        return 1;
    }
    return base * power(base, exp - 1);
}

请您先登陆,再发跟帖!