A programmer has created a hash function to map a month to a number. See if you can figure out the pattern and fill in the rest of the months of the year.
- January - 7110
- February - 826
- March - 5313
- April - 541
- May - 3513
- June - 4610
A programmer has created a hash function to map a month to a number. See if you can figure out the pattern and fill in the rest of the months of the year.
Permalink: http://problemotd.com/problem/month-hash/
Content curated by @MaxBurstein
Comments:
March boy - 10 years, 4 months ago
july - 4710 august - 681 september - 9919 october - 71015 november - 81114 december - 8124
reply permalink
Anonymous - 10 years, 4 months ago
reply permalink
Nick - 10 years, 4 months ago
Solution in plain English is that the pattern is 3 concatenated numbers, the first number is the number of letters in the month's name, the second number is the month's number, and the third number is the place in the alphabet of the month's first letter.
Nice one!
reply permalink
Patrick - 10 years, 4 months ago
This is it in Ruby.(Sorry about the indentation)
{:January=>7110, :February=>826, :March=>5313, :April=>541, :May=>3513, :June=>4610, :July=>4710, :August=>681, :October=>7915, :November=>81014, :December=>8114}
reply permalink