Skip to content

Instantly share code, notes, and snippets.

@nhuntwalker
Created December 24, 2016 00:35
Show Gist options
  • Save nhuntwalker/bc56d7be87a466388325f5ec186d1e8f to your computer and use it in GitHub Desktop.
Save nhuntwalker/bc56d7be87a466388325f5ec186d1e8f to your computer and use it in GitHub Desktop.
Write a function that takes two arguments:
- a list of numbers (not necessarily sorted)
- a number
Return the lowest index that the given number can take within the input list,
if that list was sorted.
e.g. the_list = [1, 2, 3, 4, 5], the_number = 2.5
the lowest index it can take is 2
e.g. the_list = [3, 1, 4, 2, 5], the_number = 2.5
the lowest index it can take is 2
email: nicholas@codefellows.com
Whiteboard Prompt:
Create a Stack that has a "get_min" method that always returns the minimum value
in the Stack in O(1) time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment