Given a sorted array and a target value, return the index where the target is found. If not found, return the index where it would be inserted to keep the array sorted.
For example, given and target , return . Given target , return (insert between and ).
The sorted array is your clue. You can use binary search to find the position in time instead of scanning the entire array.