Untitled
unknown
python
3 years ago
615 B
3
Indexable
def processLogs(logs, threshold): trans = [] for log in logs: trans.append(log.split()) freq = {} res = [] for t in trans: if(t[0]==t[1]): if(t[0] not in freq): freq[t[0]] = 1 else: freq[t[0]] += 1 if(t[0] not in freq): freq[t[0]] = 1 else: freq[t[0]] += 1 if(t[1] not in freq): freq[t[1]] = 1 else: freq[t[1]] += 1 for key in freq: if(freq[key]>=threshold): res.append(key) res.sort() return res
Editor is loading...