lis and an array answer of the same length as obstacles.obstacles. For each obstacle obstacles[i]:
a. Perform a binary search on lis to find the rightmost position where obstacles[i] can be inserted (let's call this position idx).
b. If idx is equal to the length of lis, append obstacles[i] to lis.
c. Otherwise, update lis[idx] with obstacles[i].
d. Update answer[i] with idx + 1.answer array after the iteration is complete.