Prime Palindrome....
IntuitionApproachComplexity
Time complexity: 24 ms

Space complexity: 44.27 MB
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: 24 ms
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: 44.27 MB
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int primePalindrome(int n) {
        if(n>=8 && n<=11) return 11;
        for(int i = n; i <= 200_000_000; i++){
            if(isPalindrome(i) && isPrime(i)){
                return i;
            }
            // Optimization: Skip even-length palindromes
            String s = String.valueOf(i);
            if (s.length() % 2 == 0) {
                // Jump to the next odd-length palindrome
                i = (int) Math.pow(10, s.length()) - 1;
            }
        }
        return -1;
    }
    private boolean isPrime(int n){
        if(n<=1) return false;
        if(n==2 || n==3) return true;//for 2,3
        if(n%2==0 || n%3==0) return false;

        for( int i = 5; i*i <= n; i += 6){
            if((n%i==0) || (n%(i+2)==0)){
                return false;
            }
        }

        return true;//for 5,7,11,13,17,19,23,29,........
    }
    private boolean isPalindrome(int n){
        String str=Integer.toString(n);
        int left=0;
        int right=str.length()-1;
        while(left<right){
            if(str.charAt(left) != str.charAt(right)){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
```
['Java']