diff options
Diffstat (limited to 'works/solutions/leetcode/cpp/680.cpp')
-rw-r--r-- | works/solutions/leetcode/cpp/680.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/works/solutions/leetcode/cpp/680.cpp b/works/solutions/leetcode/cpp/680.cpp deleted file mode 100644 index 21d150f..0000000 --- a/works/solutions/leetcode/cpp/680.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <string>
-
-using std::string;
-
-bool strict_palindrome(string::const_iterator left, string::const_iterator right)
-{
- while (left < right)
- {
- if (*left != *right)
- return false;
- ++left;
- --right;
- }
- return true;
-}
-
-class Solution
-{
-public:
- bool validPalindrome(string s)
- {
- string::const_iterator left = s.cbegin();
- string::const_iterator right = s.cend() - 1;
-
- while (left < right)
- {
- if (*left != *right)
- return strict_palindrome(left, right - 1) || strict_palindrome(left + 1, right);
-
- ++left;
- --right;
- }
- return true;
- }
-};
|