Premium problem35. Peak Date per 4 Months

Hard Locked

Given a date-indexed Series s, for each group of four consecutive calendar months return the date on which the highest value occurred.

Input

2015-01-01      0
2015-01-02      1
2015-01-05      2
2015-01-06      3
2015-01-07      4
             ... 
2015-12-25    256
2015-12-28    257
2015-12-29    258
2015-12-30    259
2015-12-31    260
Freq: B, Length: 261, dtype: int64

Output

2015-01-31   2015-01-30
2015-05-31   2015-05-29
2015-09-30   2015-09-30
2016-01-31   2015-12-31
Freq: 4ME, dtype: datetime64[ns]

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)