AlgoPlus v0.1.0
Loading...
Searching...
No Matches
palindrome.h
1#ifndef PALINDROME_H
2#define PALINDROME_H
3
4#ifdef __cplusplus
5#include <iostream>
6#include <string>
7#endif
8
16bool is_palindrome(const std::string str) {
17 int64_t _size = str.size();
18 for (int i = 0; i < _size / 2; i++) {
19 if (str[i] != str[_size - i - 1]) {
20 return false;
21 }
22 }
23 return true;
24}
25
26#endif