I’m trying The Next Palindrome problem from Sphere Online Judge (SPOJ) where I need to find a palindrome for a integer of up to a million digits. I thought about using Java’s functions for reversing Strings, but would they allow for a String to be this long?
I’m trying The Next Palindrome problem from Sphere Online Judge (SPOJ) where I need
Share
You should be able to get a String of length
Integer.MAX_VALUEalways 2,147,483,647 (231 – 1)(Defined by the Java specification, the maximum size of an array, which the String class uses for internal storage)
OR
Half your maximum heap size(since each character is two bytes) whichever is smaller.