Skip to content

[Chapse57] WEEK 01 Solution #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions valid-palindrome/Chapse57.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'''
121 이라는 숫자의 오른족 자리숫자를 알고싶으면
121 %10 =으로 1이라는 숫자를 확인할수잇고
121 /100으로 왼쪽 숫자를 확인 하는 방식으로 접근


'''

class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x <0: return False
div =1
while x >= 10* div:
div *=10

while x:
if x //div != x%10: return False #x //div==왼쪽숫자 x%10==오른쪽숫자
x= (x % div) // 10
div = div/ 100
return True