Skip to content

Commit

Permalink
Merge pull request #1026 from lhj8/main
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 7, 2024
2 parents c97587c + 4b5daab commit 4373ead
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 275 deletions.
9 changes: 0 additions & 9 deletions Changwhi/duplicate-integer.py

This file was deleted.

16 changes: 0 additions & 16 deletions Changwhi/is-anagram.py

This file was deleted.

15 changes: 0 additions & 15 deletions Changwhi/two-integer-sum.py

This file was deleted.

18 changes: 0 additions & 18 deletions Soohyeun/2024-09-23-IsAnagram.py

This file was deleted.

9 changes: 0 additions & 9 deletions Soohyeun/2024-09-23-TwoIntegerSum.py

This file was deleted.

5 changes: 0 additions & 5 deletions Soohyeun/2024-09-26-DuplicateInteger.py

This file was deleted.

35 changes: 0 additions & 35 deletions YounSangHo/Week1/2024-09-29-Duplicate-Integer.js

This file was deleted.

37 changes: 0 additions & 37 deletions YounSangHo/Week1/2024-09-29-Is-Anagram.js

This file was deleted.

22 changes: 0 additions & 22 deletions YounSangHo/Week1/2024-09-29-two-integer-sum.js

This file was deleted.

8 changes: 0 additions & 8 deletions Yunju/2024-09-28-Duplicate-Integer.py

This file was deleted.

7 changes: 0 additions & 7 deletions Yunju/2024-09-28-Is-Anagram.py

This file was deleted.

11 changes: 0 additions & 11 deletions Yunju/2024-09-28-Two-Integer-Sum.py

This file was deleted.

19 changes: 19 additions & 0 deletions hj/week 1/AnagramGroups.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>> output;
unordered_map<string, vector<string>> um;

for (string &str : strs) {
string key = str;
sort(key.begin(), key.end());
um[key].push_back(str);
}

for (auto &val : um) {
output.push_back(val.second);
}

return output;
}
};
28 changes: 28 additions & 0 deletions hj/week 1/StringEncodeAndDecode .cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class Solution {
public:

string encode(vector<string>& strs) {
string encoded = "";
for (auto &str : strs) {
encoded += to_string(str.size()) + "#" + str;
}
return encoded;
}

vector<string> decode(string s) {
vector<string> decoded;
int i = 0;

while (i < s.size()) {
int j = s.find('#', i);
int len = stoi(s.substr(i, j - i));

i = j + 1;
decoded.push_back(s.substr(i, len));

i += len;
}

return decoded;
}
};
24 changes: 24 additions & 0 deletions hj/week 1/TopKElementsInList .cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int, int> um;
priority_queue<pair<int, int>> pq;
vector<int> output;

for (auto &num : nums) {
um[num]++;
}

for (auto &pair : um) {
pq.push({pair.second, pair.first});
}

while (k > 0) {
output.push_back(pq.top().second);
pq.pop();
k--;
}

return output;
}
};
24 changes: 0 additions & 24 deletions lykim/duplicate_integer.md

This file was deleted.

31 changes: 0 additions & 31 deletions lykim/is_anagram.md

This file was deleted.

28 changes: 0 additions & 28 deletions lykim/two_sum.md

This file was deleted.

0 comments on commit 4373ead

Please sign in to comment.