3
bool timeDiff(vector<string> timestamp, int index) {4
int time1 = ((timestamp[index][0] - '0') * 10 + (timestamp[index][1] - '0')) * 60 +5
((timestamp[index][3] - '0') * 10 + (timestamp[index][4] - '0'));6
int time2 = ((timestamp[index + 2][0] - '0') * 10 + (timestamp[index + 2][1] - '0')) * 60 +7
((timestamp[index + 2][3] - '0') * 10 + (timestamp[index + 2][4] - '0'));9
if (abs(time2 - time1) <= 60) return true;13
vector<string> alertNames(vector<string> &keyName, vector<string> &keyTime) {14
unordered_map<string, vector<string>> ht;16
for (int i = 0; i < keyName.size(); i++) ht[keyName[i]].push_back(keyTime[i]);18
vector<string> result;19
for (auto time : ht) {20
sort(time.second.begin(), time.second.end());21
for (int i = 0; i + 2 < time.second.size(); i++)22
if (timeDiff(time.second, i)) {23
result.push_back(time.first);28
sort(result.begin(), result.end());35
1. store in HT as vector36
2. Check for each, 1st & 3rd in range. True if Yes