Mon Feb 26 2024 10:28:51 GMT+0000 (Coordinated Universal Time)
Saved by @hepzz03
class Solution { public boolean isPalindrome(int x) { if (x < 0 || x % 10 == 0 && x != 0) { return false; } String X = Integer.toString(x); return X.equals(new StringBuilder(X).reverse().toString()); } }
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments