Given a sorted array of distinct integers nums and a value target, return the index where target is found. If target is not present, return the index where it would be inserted to keep the array sorted. Must run in O(log n).
Example: nums = [1,3,5,6], target = 5 → 2. nums = [1,3,5,6], target = 2 → 1. nums = [1,3,5,6], target = 7 → 4.
2