Skip to content
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

[Leetcode - Easy] Valid Palindrome #16

Merged
merged 1 commit into from
Dec 21, 2024
Merged

Conversation

BangDori
Copy link
Contributor

문제

Type Info
Platform Leetcode
Level Easy
Link https://leetcode.com/problems/valid-palindrome/description/

풀이

팰린드롬 문제는 개념을 토대로 쉽게 해결한 문제라고 생각해서 딱히 풀이가 없습니다...!

어려웠던 점

  • 없음

알게된 점

1. 문자열도 스프레드 연산자를 이용해 배열로 치환할 수 있다.

const s = "hello";
console.log([...s]); // ['h', 'e', 'l', 'l', 'o'];

이게 가능한 이유는 문자열이 이터러블이기 때문이다

Copy link
Collaborator

@suhwan2004 suhwan2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. 저는 문자 체킹을 chatcodeAt로 바꾸고 범위를 잡아 풀이를 했었는데, string을 그냥 a <= str <= z로 범위를 잡아도 가능하다는 것을 이렇게 얻어가네요... 좋아요!!

@BangDori BangDori merged commit f0bb8cc into main Dec 21, 2024
2 checks passed
@BangDori BangDori deleted the bangdori/valid-palindrome branch December 21, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants