Skip to main content
All Questions

Is this a valid palindrome?

Easy

Given a string s, return true if it is a palindrome, and false otherwise. A string is considered a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Write a function isPalindrome that implements this logic.

Examples

Input: s = "H123!@321h" Output: true Input: s = "race a car" Output: false

Constraints

  • 1 <= s.length <= 2 * 10^5
  • The input string s can include any printable ASCII characters.

Interview experiences

4 shared
Google · 5 months ago
"Interviewer was very comforting but focus on more Eval part. Prepare eval better along with failover strategy, model choices."
Machine Learning Engineer · Staff / L6
Datadog · 6 months ago
"It started well, but at some point I was rushing through, so I had to take sometime and relax. I needed to clearly articulate my thoughts process well. Definitely use the STAR method in your preparation, it really worked for me"
Software Engineer · Intern
Meta · 8 months ago
"The process started with a recruiter screening testing some behavioral questions and some technical questions she read from a question bank. Then, I did a coding interview online. Finally, a 4 rounds loop online (as opposed to my previous attempt when I did the loop in one of their London (UK) offices): 2 coding interviews, 1 system design, 1 behavioral with an engineering manager."
Software Engineer · Staff / L6
Meta · 10 months ago
"I got into Meta through a referral, and the recruiter reached out quickly. The process was recruiter chat, then a pre-onsite package with CodeSignal, a live technical screen, and a weird multiple-choice engineering philosophy questionnaire, and then about a month later the onsite with DSA, system design, behavioral, and the AI-enabled coding round. Honestly, Meta gave me the best prep materials of any company I interviewed with: a long prep PDF, portal videos, mock system design resources, and even a practice environment for the AI round. Most of the coding questions were exactly the kind of stuff people tell you to study in the Meta-tagged LeetCode list, so I never felt like they were hiding the ball. I didn't get the offer, and I think the system design round was what sank me because I expected distributed systems and got an API-design style chess problem that I handled in a really unorganized way."
Software Engineer · Mid Level / L4

Related courses

Course

Machine Learning Engineer Interview Prep

Land your dream machine learning role at Meta, Google, Amazon, Apple, Microsoft, Nvidia, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Explore ML system design, core concepts, coding, behavioral interviews, and more.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.