simple java solution

  • 0
    import java.math.BigInteger;
    public class Solution {
        public int superPow(int a, int[] b) {
            StringBuilder sb = new StringBuilder();
            for(int bNum : b){
            BigInteger bb = new BigInteger(sb.toString());
            BigInteger aa = new BigInteger(String.valueOf(a));
            BigInteger result = aa.modPow(bb, new BigInteger(String.valueOf(1337)));
            return result.intValue();

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.