Binary Search: Return the First Occurrence
Given a non-decreasing integer array nums and an integer target, return the index of the first occurrence of target. Return -1 if target does not exist.
Your algorithm must run in `...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
