A coding exercise about median