ByteDance interview question

Complete a higher order functions component