Skip to content

Instantly share code, notes, and snippets.

@samuelcole
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samuelcole/1d73da2d45290c558906 to your computer and use it in GitHub Desktop.
Save samuelcole/1d73da2d45290c558906 to your computer and use it in GitHub Desktop.
Insert or move an object to the front of the list
# given a set of shows that the user is going to
going = [c, e]
# and a set of shows that are available
available = [a, b, c, d]
# 1. insert the going shows at the beginning of the array
# 2. make sure the same show doesn't appear twice
list == [c, e, a, b, d]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment