<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 {
public:
    int largestPalindrome(int n) {
        ios::sync_with_stdio(0);
        cin.tie(0);cout.tie(0);
        if(n==1)return 9;
        int l=pow(10,n)-1,r=pow(10,n-1),mod=1337;
        for(int i=l;i>=r;i--){
            string s=to_string(i),k=s;
            reverse(k.begin(),k.end());
            s+=k;
            long long ll=stol(s);
            for(int j=l;j>=sqrtl(ll);j--)
                if(ll%j==0)
                    return ll%mod;
        }
        return 0;
    }
};
11900