1601-1610¶
class Solution {
public:
vector <string> alertNames(vector <string> &keyName, vector <string> &keyTime) {
unordered_map <string, vector<int>> map;
int n = keyName.size();
for (int i = 0; i < n; ++i) {
int hour = (keyTime[i][0] - '0') * 10 + (keyTime[i][1] - '0');
int minute = (keyTime[i][3] - '0') * 10 + (keyTime[i][4] - '0');
map[keyName[i]].emplace_back(hour * 60 + minute);
}
vector <string> res;
for (auto &[name, times]: map) {
sort(times.begin(), times.end());
int size = times.size();
for (int i = 2; i < size; ++i) {
if (times[i] - times[i - 2] <= 60) {
res.emplace_back(name);
break;
}
}
}
sort(res.begin(), res.end());
return res;
}
};
1611-1620¶
1621-1630¶
1631-1640¶
1641-1650¶
1651-1660¶
1661-1670¶
class Solution {
public:
ListNode *mergeInBetween(ListNode *list1, int a, int b, ListNode *list2) {
auto point1 = list1, point2 = list2;
for (int i = 1; i < a; ++i) point1 = point1->next;
auto dummy = point1->next;
point1->next = list2;
for (int i = 0; i <= b - a; ++i) dummy = dummy->next;
while (point2->next) point2 = point2->next;
point2->next = dummy;
return list1;
}
};
1671-1680¶
1681-1690¶
1691-1700¶