package leetcode;

/**
 * https://leetcode.com/problems/super-pow/
 */
public class Problem372 {
    public int superPow(int a, int[] b) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem372 prob = new Problem372();
        System.out.println(prob.superPow(2, new int[]{3})); // 8
        System.out.println(prob.superPow(2, new int[]{1, 0})); // 1024
    }
}

@@ -12,16 +12,46 @@
 tcode;%0A%0A
+import java.math.BigInteger;%0A%0A
 /**%0A * h
@@ -177,262 +177,391 @@
  // 
-TODO%0A        return 0
+https://en.wikipedia.org/wiki/Modular_exponentiation#Memory-efficient_method%0A        BigInteger bia = new BigInteger(%22%22 + a)
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem372 prob = new Problem372();%0A        System.out.println(prob.superPow(2, new int%5B%5D%7B3%7D)); // 8%0A        System.out.println(prob.super
+StringBuilder sb = new StringBuilder();%0A        for (int i = 0; i %3C b.length; i++) %7B%0A            sb.append(b%5Bi%5D);%0A        %7D%0A        BigInteger bib = new BigInteger(sb.toString());%0A        return bia.mod
 Pow(
-2
+bib
 , new 
-int%5B%5D%7B1, 0%7D)); // 1024
+BigInteger(%22%22 + 1337)).intValue();
 %0A   

Solve problem 372