Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Palindrome Checker Function

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Palindrome Checker Function. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Inc. In processes user-entered labels that may contain spaces, punctuation, and mixed capitalization. Create a function that determines whether a string is a palindrome after normalization.

A normalized string keeps only alphanumeric characters and treats uppercase and lowercase letters as equal. Return True if the normalized string reads identically from left to right and right to left; otherwise, return False.

Formal Specification

Implement is_palindrome(text), where text is a string. The function must return a boolean. An empty normalized string is considered a palindrome.

Use a two-pointer approach that compares characters from both ends while moving toward the center. Do not modify the input string in place.

Constraints

  • 1 <= len(text) <= 2 * 10^5
  • text contains printable ASCII characters
  • Only letters and digits are compared
  • Comparisons are case-insensitive

Function Signature

def is_palindrome(text):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output