Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Palindrome Number Implementation

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

Your question is Palindrome Number Implementation. 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

Write code to check whether a number is a palindrome. Implement is_palindrome(x) for an integer input and return a boolean; negative numbers are not palindromes, and leading zeros are not represented. For example, 121 returns True, while -121 and 10 return False; assume -2^31 <= x <= 2^31 - 1.

Constraints

  • -2^31 <= x <= 2^31 - 1
  • The input is a single integer.
  • Return True or False.
  • Leading zeros are not represented in the input.

Function Signature

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