c++ even/odd length palindrome merge sort like solution. interviewer really loves it, kiss
\n#include <string>\n#include <algorithm>\n#include <iostream>\n\nusing namespace std;\n\nclass Solution {\npublic:\n    int evenPalindrome(int num) {\n        
```\n#include <string>\n#include <algorithm>\n#include <iostream>\n\nusing namespace std;\n\nclass Solution {\npublic:\n    int evenPalindrome(int num) {\n        string str1 = to_string(num);\n        string str2 = str1;\n        reverse(str2.begin(), str2.end());\n        return stoi(str1 + str2);\n    }\n\n    int oddPlaindrome(int num) {\n        string str1 = to_string(num);\n        string str2 = str1.substr(0, str1.length() - 1);\n        reverse(str2.begin(), str2.end());\n        return stoi(str1 + str2);\n    }\n\n    bool isPrime(int num) {\n        if (num == 1) {\n            return false;\n        }\n        for (int i = 2; i * i <= num; ++i) {\n            if (num % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\npublic:\n    int primePalindrome(int N) {\n        int even = 1;\n        int odd = 1;\n\n        int cur = 0;\n        do {\n            int evenp = evenPalindrome(even);\n            int oddp = oddPlaindrome(odd);\n            cur = min(evenp, oddp);\n            if (evenp < oddp) {\n                ++even;\n            } else {\n                ++odd;\n            }\n        } while (!(cur >= N && isPrime(cur)));\n\n        return cur;\n    }\n};\n\n#if DEBUG\nint main(int argc, char** argv) {\n    return 0;\n}\n#endif\n\n```
[]