Question: ```
package testing.project;

public class PalindromeThreeDigits {

    public static void main(String[] args) {
        int value = 0;
        for(int i = 100;i <=999;i++)
        {
            for(int j = i;j <=999;j++)
            {
                int value1 = i * j;
                StringBuilder sb1 = new StringBuilder(""+value1);
                String sb2 = ""+value1;
                sb1.reverse();
                if(sb2.equals(sb1.toString()) && value<value1) {
                    value = value1;

                }

            }
        }

        System.out.println(value);
    }
}

```

This is the code that I wrote in Java... Is there any efficient way other than this.. And can we optimize this code more??

Answer: 
```
public class Pin
{
    public static boolean isPalin(int num)
    {
        char[] val = (""+num).toCharArray();
        for(int i=0;i<val.length;i++)
        {
            if(val[i] != val[val.length - i - 1])
            {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args)
    {
        for(int i=999;i>100;i--)
            for(int j=999;j>100;j--)
            {
                int mul = j*i;
                if(isPalin(mul))
                {
                    System.out.printf("%d * %d = %d",i,j,mul);
                    return;
                }
            }
    }
}

```
What about : in python

```
>>> for i in range((999*999),(100*100), -1):
...     if str(i) == str(i)[::-1]:
...         print i
...         break
...
997799
>>>

```