(int x, int n)
| 93 | } |
| 94 | |
| 95 | public static int optimizedPower(int x, int n) { |
| 96 | if(n == 0) { |
| 97 | return 1; |
| 98 | } |
| 99 | |
| 100 | if(n % 2 == 0) { //even |
| 101 | return optimizedPower(x, n/2) * optimizedPower(x, n/2); |
| 102 | } else { //odd |
| 103 | return x * optimizedPower(x, n/2) * optimizedPower(x, n/2); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | public static int tilingProblem(int n) { // 2 x n (floor size) |
| 108 | //base case |
nothing calls this directly
no outgoing calls
no test coverage detected