Meta interview question

2 coding questions, medium difficulty