Skip to content

Bug Report for pow-x-n: Solution accepted even though it fails test case x = 0, n = 0. #5839

@halderarnab

Description

@halderarnab

Bug Report for https://neetcode.io/problems/pow-x-n

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

Solution accepted even though it fails manually added test case x = 0, n = 0.

class Solution {
public double myPow(double x, int n) {
double res = 1;
if(n < 0){
x = 1 / x;
n *= -1;
}
for(int i = 0; i < n; i++) {
res = res * x;
}
return res;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions