Microsoft interview question

Please implement a memory allocate function