Last Sunday


Write a method that returns the last Sunday of each month for a given year.

Example

last_sunday(2013)
2013-01-27
2013-02-24
2013-03-31
2013-04-28
2013-05-26
2013-06-30
2013-07-28
2013-08-25
2013-09-29
2013-10-27
2013-11-24
2013-12-29

Hint

If you input the year 2020, a leap year, is the last Sunday of February 2020-02-23?
If you input the year 2032, also a leap year, is the last Sunday February 2032-02-29?

Solutions

You can find all language solutions here Last Sunday Solutions
Or you can select a specific language below.