Locked
Pass the Dictionary check first
Everything after it builds on dictionaries. Each rep in the check has to be passed without opening the solution. Hints and Basics are fine.
Still to clear · 8 of 8
- Trace: keep the table
- Which line crashes?
- Write: menu from two lists
- Write: total a bill
- Debug: cheapest item
- Write: items under a budget
- Write: who sits where
- Write: apply price changes
Preview · where this ladder is heading
Binary Search
You get a list of distinct integers in increasing order, and a value to look for. Return the position of that value in the list, or -1 if it isn't there.
Your solution must take O(log n) time, so a linear scan is not allowed.
search([-1, 0, 3, 5, 9, 12], 9) → 4 search([-1, 0, 3, 5, 9, 12], 2) → -1 (2 isn't in the list)
innums = [-4, 0, 3, 8, 15], target = 8out3
innums = [-4, 0, 3, 8, 15], target = 2out-1
innums = [6], target = 6out0
You can read it now. The editor opens when the check is cleared.