Given a list of diagnoses from certain illnesses for multiple patients over a certain period. Each diagnosis contains an illness (eg. cholera, dengue,…) and a day of diagnosis. Days are numbered starting from zero. The order of diagnoses is completely arbitrary.

Your task is to check if there is an epidemic of a certain illness in a given period. An illness is an epidemic if there are more than \(k\) successive days where the illness is diagnosed strictly more than \(n\) times per day. Both \(k\) and \(n\) are given as parameter.

Assignment

Write a Python function findEpidemic(diagnoses:list, k:int, n:int) that returns a set of every epidemic over the given data. The diagnoses are represented by a list of tuples.

Examples

>>> findEpidemic([("cholera", 0),("dengue", 0),("cholera", 0),("cholera", 0),("cholera", 0),("cholera", 1),("cholera", 1),("cholera", 1),("cholera", 1),("cholera", 2),("cholera", 2),("dengue", 2),("cholera", 2),("cholera", 2)], 3,3)
{'cholera'}
>>> findEpidemic([("cholera",0),("cholera",0),("cholera",0),("cholera",0),("cholera",0),("cholera",1),("cholera",1),("cholera",1),("cholera",1),("cholera",5),("cholera",5),("cholera",5),("cholera",5),("cholera",6),("cholera",6),("cholera",6),("cholera",6),("cholera",6)],3,3)
set()
>>> findEpidemic([("cholera",0),("cholera",0),("cholera",0),("cholera",1),("cholera",1),("cholera",1),("cholera",1),("cholera",2),("cholera",2),("cholera",3),("cholera",3),("cholera",3),("cholera",4),("cholera",4),("cholera",4)],3,2)
set()
>>> findEpidemic([("cholera",0),("dengue", 0),("dengue", 3),("dengue", 5),("cholera",2),("cholera",1),("dengue", 2),("cholera",3),("dengue", 4)],4,0)
{'cholera', 'dengue'}
>>> findEpidemic([],1,1)
set()