Dandy (NY) interview question

Create your own implementation of flatmap