Search Insert Position

easy
Unit 1 · Binary Search & Heaps0/3 to milestone

Given a sorted list of distinct integers and a target, return the index of target if present, otherwise the index where it would be inserted to keep the list sorted. Run in O(log n) without using bisect.

#binary-search#arrays2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Search Insert Position · TechGradify