Algorithm

Used the binary search to implement the solution. Comparing the values if array[min] and array[max] are the same.

```
class Solution {
public boolean isPalindrome(int x) {
if(x > 0) {
String st = String.valueOf(x);
char[] c = st.toCharArray();
int low = 0;
int high = st.length() - 1;
while(low < high) {
if(c[low] != c[high]) {
return false;
} else {
low++;
high--;
}
}
return true;
}
if(x == 0) {
return true;
}
return false;
}
}
```

Time complexity:

O() = O(log n)

Space complexity:

O() = O(1)