| 1 | class Solution { |
| 2 | public: |
| 3 | bool isPalindrome(string s) { |
| 4 | string filtered; |
| 5 | for (char c : s) { |
| 6 | if (isalnum(c)) { |
| 7 | filtered += tolower(c); |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | int left = 0; |
| 12 | int right = filtered.size() - 1; |
| 13 | |
| 14 | while (left < right) { |
| 15 | if (filtered[left] != filtered[right]) { |
| 16 | return false; |
| 17 | } |
| 18 | left++; |
| 19 | right--; |
| 20 | } |
| 21 | |
| 22 | return true; |
| 23 | } |
| 24 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected