<p>Given an integer n, return <em>the <strong>largest palindromic integer</strong> that can be represented as the product of two <code>n</code>-digits integers</em>. Since the answer can be very large, return it <strong>modulo</strong> <code>1337</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = 2
<strong>Output:</strong> 987
Explanation: 99 x 91 = 9009, 9009 % 1337 = 987
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = 1
<strong>Output:</strong> 9
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 8</code></li>
</ul>

class Solution:
    def largestPalindrome(self, n):
        """
        :type n: int
        :rtype: int
        """
        if n == 1: return 9
        for z in range(2, 2 * (9 * 10**n) - 1):
            left = 10**n - z
            right = int(str(left)[::-1])
            root_1, root_2 = 0, 0
						
            if z**2 - 4*right < 0:
                continue
            else:
                root_1 = 1/2 * (z + (z**2-4*right)**0.5)
                root_2 = 1/2 * (z - (z**2-4*right)**0.5)
                if root_1.is_integer() or root_2.is_integer():
                    return (10**n*left+right) %1337
16600