Back to course home
0% completed
Vote For New Content
Corner case missed while testing.
Rohit Ranjan
May 2, 2025
My code passed!! But it shouldn't pass for string: "ra4d5ar".
#include <bits/stdc++.h> using namespace std; class Solution { public: bool checkPalindrome(string s) { queue<char> q; string str{}; for(char c: s){ if(c>='a' && c<='z'){ str += c; } else if(c>='A' && c<='Z'){ str += (c+32); } } for(char c : str){ q.push(c); } for(int i=str.length()-1; i>0; i--){ char ch1 = str[i]; char ch2 = q.front(); if(ch1 != ch2){ return false; } q.pop(); } return true; } };
0
0
Comments
Comments
On this page