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

Method helper

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

Source from the content-addressed store, hash-verified

15 }
16
17 private double helper(double x, int n) {
18 if (n == 0) return 1;
19 if (n == 1) return x;
20 double d = helper(x, n >>> 1);
21 if (n % 2 == 0) return d * d;
22 return d * d * x;
23 }
24
25 public static void main(String[] args) {
26 Solution solution = new Solution();

Callers 1

myPowMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected