Clear maintains sorted integer identifiers for an onboarding workflow. Given a nondecreasing array of identifiers and a target value, return the target's 1-indexed position if it exists. If it does not exist, return the negative 1-indexed position where it should be inserted to preserve sorted order.
Use binary search and achieve O(log n) time. If the target appears multiple times, return the position of its first occurrence.
Implement find_position(nums, target):
nums is a nondecreasing list of integers.target is an integer.i, return i + 1.i, return -(i + 1).def find_position(nums, target):