FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithm-examples/cpp-algorithm/src/string/palindrome.cpp at main · codejsha/algorithm-examples · GitHub
codejsha
/
algorithm-examples
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithm-examples
/
cpp-algorithm
/
src
/
string
/
palindrome.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (23 loc) · 533 Bytes
Breadcrumbs
algorithm-examples
/
cpp-algorithm
/
src
/
string
/
palindrome.cpp
Copy path
File metadata and controls
25 lines (23 loc) · 533 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
#
include
"
palindrome.h
"
auto
Palindrome::IsPalindromic1
(
const
std::string& str) -> bool
{
for
(
int
i =
0
; i <
static_cast
<
int
>(str.
length
()) /
2
; ++i)
{
if
(str[i] != str[str.
length
() -
1
- i])
{
return
false
;
}
}
return
true
;
}
auto
Palindrome::IsPalindromic2
(
const
std::string& str) -> bool
{
for
(
int
i =
0
, j =
static_cast
<
int
>(str.
length
()) -
1
; i < j; ++i, --j)
{
if
(str[i] != str[j])
{
return
false
;
}
}
return
true
;
}
Back
|
FazBrowse Home
|
New Git URL