| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- DWG
- Generator
- Python Implementation
- Decorator
- Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- Protocol
- Python
- data science
- 파이썬
- 운영체제
- shiba
- 43. Multiply Strings
- Class
- 시바견
- Python Code
- t1
- 밴픽
- 프로그래머스
- iterator
- 컴퓨터의 구조
- Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- 715. Range Module
- concurrency
- kaggle
- attribute
- Regular Expression
- 109. Convert Sorted List to Binary Search Tree
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 |