Paytm Labs interview question

Write a function to flatten an array and a binary search question