MCPcopy Create free account
hub / github.com/Blankj/awesome-java-leetcode / myPow

Method myPow

src/com/blankj/medium/_0050/Solution.java:12–15  ·  view source on GitHub ↗
(double x, int n)

Source from the content-addressed store, hash-verified

10 */
11public class Solution {
12 public double myPow(double x, int n) {
13 if (n < 0) return helper(1 / x, -n);
14 return helper(x, n);
15 }
16
17 private double helper(double x, int n) {
18 if (n == 0) return 1;

Callers 1

mainMethod · 0.95

Calls 1

helperMethod · 0.95

Tested by

no test coverage detected