Find First and Last Position of Element
Medium
Binary Search
Given a sorted array and a target, print the first and last index at which target appears. Print -1 -1 if the target is absent. The solution must run in O(log n).
Constraints
0 <= n <= 10^5 -10^9 <= nums[i], target <= 10^9
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.