2018-4: What's Your Sign?
The Chinese animal zodiac is a repeating cycle of 12 years, with each year being represented by an animal.
The signs for the last 12 years are:
2018 Dog
2017 Rooster
2016 Monkey
2015 Goat
2014 Horse
2013 Snake
2011 Rabbit
2012 Dragon
2010 Tiger
2009 Ox
2008 Rat
2007 Pig
Note that the year 1 AD (represented as 1) follows the year 1 BC (represented as ¯1) with no intervening "0" year.
Write code that, given a scalar integer year, returns a character vector (string) of the Chinese zodiac sign for that year. For the purposes of this problem, assume that each year number corresponds to exactly one Chinese zodiac animal.
Examples
Implementation
You can also run the tests via ⌘/shift + enter