# Who was the biggest "Weekend Update" host during that time period?

These are the hosts of the "Weekend Update" news segment on Saturday Night Live, with the years they hosted and their initials:

Chevy Chase         1975-1976  CC
Jane Curtain        1976-1980  JC
Dan Aykroyd         1977-1978  DA
Bill Murray         1978-1980  BM
Charles Rocket      1980-1981  CR
Gail Matthius       1981       GM
Brian Doyle-Murray  1981-1982  BD
Mary Gros           1981-1982  MG
Christine Ebersole  1982       CE
Christopher Guest   1984-1985  CG
Dennis Miller       1985-1991  DM
Kevin Nealon        1991-1994  KN
Norm MacDonald      1994-1997  NM
Colin Quinn         1998-2000  CQ
Jimmy Fallon        2000-2004  JF
Tina Fey            2000-2006  TF
Amy Poehler         2004-2008  AP
Seth Meyers         2006-2014  SM
Cecily Strong       2013-2014  CS
*Colin Jost         2014-pres  CJ
*Michael Che        2014-pres  MC

*At the time of this writing, present is 2017.


I got most of the years this website, but later ones I got from Wikipedia.

The task is simple. Given a range of years, output the initials of the person who was host during the most years in that time period. If there is a tie, output the initials of all the hosts that tied. Note that sometimes "Weekend Update" only has 1 host and sometimes it has 2.

For example, if the input is 1984-1985, output CG because he was the only person to host during both of those years.

# Specifics

• Input is flexible, but it will always consist of a start year and a later end year. Also you don't need to include the first two digits of the year: 95-05 is fine for 1995-2005.
• Assume all ranges are inclusive: 1982-1984 means 1982,1983,1984.
• For input, the earliest start year is 1975 and the latest end year is 2017

# Examples

• 1983-1987 => DM (he hosted '85,'86,'87)
• 1999-2001 => CQ JF TF [CQJFTF also ok] (all hosted during two of those years)
• 1975-2017 => SM (has 9 years!)
• 1990-2000 => KN NM (both have 4 years)
• 2013-2015 => SM CS CJ MC (all have 2 years)
• Hm, currently this challenge seems to be about who can encode the hosts + years the best. Have you considered having the hosts + years also as an input? Jul 18, 2017 at 21:18
• @StepHen Yeah, but I'm interested in how people are creative with encoding, and tried to make the names as short as possible as such. Jul 18, 2017 at 21:20
• I knew there was a tag for this, found it. I really thought there was also a tag for storing data like that efficiently, but I couldn't find it. Jul 18, 2017 at 21:27
• @StepHen Are you thinking of Kolmogorov Complexity? Jul 18, 2017 at 21:29
• I guess that is what I am thinking of, although it doesn't quite match this challenge. I was always under the assumption that KC was for constant output, but I just checked the tag wiki and that's not what it says. Jul 18, 2017 at 21:31

# Python 2, 291 bytes

def f(b,e):
s=''.join('A AB BC BCD BD BDE EFGH GHJ J JK KL L L L L L LM M M MN N N N O O OPQ PQ PQ PQ PQR QR QRS RS RS S S S S ST STUV UV UV UV'.split()[b-1975:e-1974]);C=s.count;return''.join({'CJDBCGBMCBCDKNCJTASCCMCCAMRMDGEHGMNMQFFPMSJC'[ord(h)-65::22]for h in s if C(h)==max(map(C,s))})


Try it online!

# Python 2, 325 bytes

def f(x,y):a=sum([s.split(',')for s in('CC CC,JC JC,DA JC,DA,BM JC,BM JC,BM,CR CR,GM,BD,BD BD,MG,CE,BH BH BH,CG CG,'+'DM '*6+'DM,KN KN KN KN,'+'NM '*4+'CQ CQ CQ,'+'JF,TF '*4+'JF,TF,AP TF,AP TF,AP,SM AP,SM AP,'+'SM '*5+'SM,CS SM,CS,'+'CJ,MC '*4).split()[x-1975:y-1974]],[]);c=a.count;print{s for s in a if c(s)==max(map(c,a))}


Try it online!

### 284 bytes, but more boring:

def f(x,y):a=sum([s.split(',')for s in'eJx1z9sJwzAUBNFWtoBpwlrZCgrX+NV/LVEiHBxMYDjs79qyqVY1eeiS4j1O8SZvlCDllppR8Eh66BMuciGHbvGcdcYc+ua1R504Jv2RYdFF9tDV3/DexZVov26+ACfwONE='.decode('base64').decode('zip').split()[x-1975:y-1974]],[]);c=a.count;print{s for s in a if c(s)==max(map(c,a))}


Try it online!

• There's at least one secret you haven't found yet that saves a couple (or more) bytes. Jul 18, 2017 at 22:54
• @geokavel I can get down by 20 or so bytes I think. I'm trying to beat the "zip the text and decode it" approach but I haven't so far Jul 18, 2017 at 23:08
• @rosslh I don't think you saved your TIO link Jul 19, 2017 at 0:02
• fixed link: tio.run/##dY5Bb4JAEIXv/… Jul 19, 2017 at 0:06
• Interestingly, using the % formatting is the same length as without the % formatting Jul 19, 2017 at 0:15

## JavaScript (ES6), 201200 199 bytes

Takes the year range in currying syntax (a)(b). Returns a string made of concatenated initials.

a=>b=>"MCCJCSSMAPTFJFCQNMKNDMCGBHCEMGBDGMCRBMDAJCCC".match(/../g).reduce((o,c,n)=>(s=(a<(x-='0017240243612010012111'[n])?x:a)-(b<(y=+'3318464233612011012141'[n]+x)?b:y))>m?o:s<m?(m=s,c):c+o,m=x=2014)


### Test cases

let f =

a=>b=>"MCCJCSSMAPTFJFCQNMKNDMCGBHCEMGBDGMCRBMDAJCCC".match(/../g).reduce((o,c,n)=>(s=(a<(x-='0017240243612010012111'[n])?x:a)-(b<(y=+'3318464233612011012141'[n]+x)?b:y))>m?o:s<m?(m=s,c):c+o,m=x=2014)

console.log(f(1983)(1987)) // => DM
console.log(f(1999)(2001)) // => CQ JF TF
console.log(f(1975)(2017)) // => SM
console.log(f(1990)(2000)) // => KN NM
console.log(f(2013)(2015)) // => SM CS CJ MC`