일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 시바견
- LeetCode
- 밴픽
- Protocol
- iterator
- 43. Multiply Strings
- Generator
- 컴퓨터의 구조
- 운영체제
- attribute
- t1
- Regular Expression
- kaggle
- 109. Convert Sorted List to Binary Search Tree
- Decorator
- Convert Sorted List to Binary Search Tree
- Python Code
- 315. Count of Smaller Numbers After Self
- Python Implementation
- Class
- 프로그래머스
- 파이썬
- 30. Substring with Concatenation of All Words
- Python
- shiba
- concurrency
- DWG
- 715. Range Module
- data science
- Substring with Concatenation of All Words
Archives
- Today
- Total
Scribbling
[C++] 49. Group Anagrams 본문
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> map;
for (string str : strs) {
string sorted_str = str;
sort(sorted_str.begin(), sorted_str.end());
map[sorted_str].push_back(str);
}
vector<vector<string>> ret;
for (auto e : map) {
ret.push_back(e.second);
}
return ret;
}
};
'Computer Science > C++' 카테고리의 다른 글
[C++] LeetCode 238. Product of Array Except Self (0) | 2023.08.18 |
---|---|
[C++] priority queue (vector<int>) with comparator (0) | 2023.08.18 |
[C++] LeetCode 242. Valid Anagram (0) | 2023.08.18 |
[C++] LeetCode 217. Contains Duplicate (0) | 2023.08.18 |
[C++ Reminder] LeetCode: 15. 3Sum (0) | 2023.01.26 |