LeetCode – 9. Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.

This problem is actually quite boring; you can't use extra space. I can't figure out how to avoid using extra space. Hopefully, some expert can point it out.

public class Solution { public boolean isPalindrome(int x) { if(x<0) return false; String s = Integer.toString(x); int j=s.length() -1; int i = 0; while(i 

This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:

Original author:Jake Tao,source:「LeetCode – 9. Palindrome Number」

147
0 0 147

Further Reading

Post a reply

Log inYou can only comment after that.
Share this page
Back to top