<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:
    bool isPalindrome(string str){
        int i=0;int j=str.size()-1;
        while(i<j){
            if(str[i]!=str[j])return false;
            i++,j--;
        }
        return true;
    }
    int largestPalindrome(int n) {
        long long temp;
        if(n==3)return 123;
        if(n==5)return 677;
        if(n==7)return 877;

        for(int i=pow(10,n)-1;i>=pow(10,n-1);i--){
            for(int j=pow(10,n)-1;j>=pow(10,n-1);j--){
                if(i!=j){
                    temp=1ll*i*j;
                    if(isPalindrome(to_string(temp))){
                        return temp%1337;
                        
                    }

                }
                if(i==j)continue;
            }
        }
        return -1;
        
    }
};
10100