Given a year, determine whether SnackDown was hosted in that year or not. SnackDown was hosted in years 2010, 2015, 2016, 2017 and 2019.
SUPER QUICK EXPLANATION
- Explanation is even quicker.
Read the number, and check if N is one of the above years. If yes, print “HOSTED”. Otherwise, print “NOT HOSTED”.
If-else clause or set can be used for checking if N is one of the years in which contest was hosted.
Editorialist’s rant: Few of my friends said that they like short and to the point editorials. Here you go! xD
Time complexity is O(1) per test case.
AUTHOR’S AND TESTER’S SOLUTIONS:
Feel free to Share your approach, If it differs. Suggestions are always welcomed.