Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    372 - Super Pow.

    Medium

    Your task is to calculate <code>a<sup>b</sup></code> mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.

    Example 1:

    Input: a = 2, b = 3

    Output: 8

    Example 2:

    Input: a = 2, b = 1,0

    Output: 1024

    Example 3:

    Input: a = 1, b = 4,3,3,8,5,2

    Output: 1

    Constraints:

    • <code>1 <= a <= 2<sup>31</sup> - 1</code>

    • 1 &lt;= b.length &lt;= 2000

    • 0 &lt;= b[i] &lt;= 9

    • b does not contain leading zeros.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer superPow(Integer a, IntArray b)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait