|
1 |
| -/** |
2 |
| - * 9. Palindrome Number |
3 |
| - * |
4 |
| - * Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. |
5 |
| -
|
6 |
| -Example 1: |
7 |
| -
|
8 |
| -Input: 121 |
9 |
| -Output: true |
10 |
| -Example 2: |
11 |
| -
|
12 |
| -Input: -121 |
13 |
| -Output: false |
14 |
| -Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. |
15 |
| -Example 3: |
16 |
| -
|
17 |
| -Input: 10 |
18 |
| -Output: false |
19 |
| -Explanation: Reads 01 from right to left. Therefore it is not a palindrome. |
20 |
| -Follow up: |
21 |
| -
|
22 |
| -Coud you solve it without converting the integer to a string? |
23 |
| -*/ |
24 |
| - |
25 | 1 | classSolution1 {
|
26 | 2 | /**This is a Java translation, while its Java counterpart could be accepted perfectly, this one failed due to
|
27 | 3 | * Char 21: runtime error: signed integer overflow: 746384741 * 10 cannot be represented in type 'int' (solution.cpp)
|
|