Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Palindrome Algorithm Implementation
00:00
5 left

Palindrome Algorithm Implementation

EasyPython

Problem

Staffline Solutions validates short reference strings before processing them. Implement an algorithm that determines whether a given string is a palindrome, meaning it reads the same from left to right and right to left.

Treat uppercase and lowercase letters as different characters, and compare every character exactly as provided. Do not remove spaces, punctuation, or other symbols.

Formal Specification

Implement is_palindrome(s), where s is a string. Return True if s is a palindrome and False otherwise. The function must not modify the input string.

Constraints

  • 0 <= len(s) <= 10^5
  • The string may contain letters, digits, whitespace, punctuation, and symbols
  • Comparisons are case-sensitive
  • The input string must not be modified

Function Signature

def is_palindrome(s):
Interviewer

Your question is Palindrome Algorithm Implementation. Start with the requirements in the Question tab.

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.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.