Skip to content

Palindrome Number #32606

@amjadkhhan

Description

@amjadkhhan

LeetCode Username

amjadkhhan

Problem Number, Title, and Link

  1. Palindrome Number https://leetcode.com/problems/palindrome-number/

Bug Category

Problem hints, Problem constraints, Incorrect test case (Output of test case is incorrect as per the problem statement)

Bug Description

The output was always false for positive number

Language Used for Code

Python/Python3

Code used for Submit/Run operation

class Solution:
    def isPalindrome(self, x: int) -> bool:
        if x < 0 or (x % 10 == 0 and x !=0):
            return False
        rev=0
        temp=x
        while (x!=0):
            digit=x%10
            rev=rev*10+digit
            x=x//10
        return temp==rev

Expected behavior

Was not getting an expected answer

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions