-
Notifications
You must be signed in to change notification settings - Fork 0
[LeetCode] 9. Palindrome Number #51
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @param {number} x | ||
* @return {boolean} | ||
*/ | ||
const isPalindrome = function (x) { | ||
if (x < 0) return false; | ||
|
||
const array = [...String(x)]; | ||
for (let i = 0; i < array.length / 2; i++) { | ||
if (array[i] !== array[array.length - 1 - i]) return false; | ||
} | ||
|
||
return true; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 바뀐 구현 방법이 코드가 간결하고 더 쉽게 구현이 되는것 같습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제 PR 글 내용도 읽어보시는군여😏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 당근 다봐야죠 ㅎㅎㅎㅎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Explanation: ' 부분은 구현 안하셨나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 처음 이 문제 받았을 때는 구현을 했었는데요~!
리트코드에서 그냥 넣어주는 거였더라고요🤣