일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- concurrency
- LeetCode
- Substring with Concatenation of All Words
- Python Implementation
- Convert Sorted List to Binary Search Tree
- 109. Convert Sorted List to Binary Search Tree
- Python
- Python Code
- 컴퓨터의 구조
- 43. Multiply Strings
- kaggle
- Class
- 파이썬
- iterator
- Decorator
- Protocol
- shiba
- Regular Expression
- 315. Count of Smaller Numbers After Self
- attribute
- 프로그래머스
- DWG
- 시바견
- 30. Substring with Concatenation of All Words
- 밴픽
- 715. Range Module
- data science
- Generator
- 운영체제
- t1
Archives
- Today
- Total
Scribbling
[C++] isalnum, tolower 본문
LeetCode 125. Valid Palindrome
https://leetcode.com/problems/valid-palindrome/
class Solution {
public:
bool isPalindrome(string s) {
vector<char> vec;
for (char c : s) {
if (isalnum(c)) {
vec.push_back(tolower(c));
}
}
if (vec.empty()) {
return true;
}
auto left = vec.begin();
auto right = vec.end() - 1;
while (left < right) {
if (*left != *right) {
return false;
}
left++;
right--;
}
return true;
}
};
'Computer Science > C++' 카테고리의 다른 글
[C++] Load Balancing (0) | 2023.08.19 |
---|---|
[C++] lower_bound, upper_bound (0) | 2023.08.18 |
[C++] LeetCode 128. Longest Consecutive Sequence (0) | 2023.08.18 |
[C++] LeetCode 238. Product of Array Except Self (0) | 2023.08.18 |
[C++] priority queue (vector<int>) with comparator (0) | 2023.08.18 |