FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Leetcode/problem9_Palindrome_Number.cpp at master · wangjiefeng/Leetcode · GitHub
wangjiefeng
Leetcode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Leetcode
/
problem9_Palindrome_Number.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (29 loc) · 593 Bytes
Breadcrumbs
Leetcode
/
problem9_Palindrome_Number.cpp
Copy path
File metadata and controls
29 lines (29 loc) · 593 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
*比较基础的一道题 Runtime:75ms!!!
**就是有点慢
*
*/
class
Solution
{
public:
bool
isPalindrome
(
int
x)
{
if
( x <
0
)
return
false
;
if
( x /
10
==
0
)
return
true
;
int
base =
1
;
while
(x/base >=
10
)
{
base = base*
10
;
}
int
left;
int
right;
while
(x >
0
)
{
right = x%
10
;
left = x/base;
if
(right != left)
return
false
;
x = (x - left*base)/
10
;
base /=
100
;
}
return
true
;
}
};
Back
|
FazBrowse Home
|
New Git URL