solve(nums, target) — nums is sorted ascending with distinct values. Return the
index of target if it is present, otherwise the index where it would have to be
inserted to keep the array sorted. Run in O(log n).
This is the lower bound: the first index whose value is >= target. Almost every
binary-search variant is a lower bound in disguise, so write it with a half-open range[lo, hi) and never return early.
Examples
solve([1,3,5,6], 5) → 2
solve([1,3,5,6], 2) → 1
solve([1,3,5,6], 7) → 4
solve([1,3,5,6], 0) → 0Sample tests