Given a sorted array of integers nums and integer target, return the index of target if found, or -1 if not. Must run in O(log n) time.
Input: nums = [-1,0,3,5,9,12], target = 9 Output: 4
Input: nums = [-1,0,3,5,9,12], target = 2 Output: -1
Input: nums = [5], target = 5 Output: 0
Jnaneshwara Reddy Satti
Builder · ClearCode
Hi — I'm a 21yo CS grad from India. I built ClearCode while recovering from a surgery, because I genuinely believe DSA should be visual, free, and accessible to everyone. No VC funding. No team. Just me, my laptop, and a lot of chai. ☕
If ClearCode helped you understand even one concept — consider supporting it. Every rupee keeps the servers running and new videos coming.