Skip to content

Instantly share code, notes, and snippets.

View jooyous's full-sized avatar
🐘

Julia Matsieva jooyous

🐘
View GitHub Profile

Question

Given a JSON file that contains American Indian reservation records, write a function get_reservations, which, when given exactly one of placeCode, stateCode or aiaNNHCE 1, will return a list of reservations with this property.

Requirements:

  1. The given data should be loaded one time.
  2. get_reservations should use the data to give the answer in constant (O(1)) time.

Example

get_reservations called with place code "14860" should return

Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build.N8G2j/oslo.config
Storing complete log in /home/julia/.pip/pip.log
+ safe_chown -R julia /opt/stack/glance/glance.egg-info
+ _safe_permission_operation chown -R julia /opt/stack/glance/glance.egg-info
+ args=($@)
+ local args
+ local last
+ local sudo_cmd
+ local dir_to_check
File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(*args, **kw)
File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 25, in urlmap_factory
app = loader.get_app(app_name, global_conf=global_conf)
File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
name=name, global_conf=global_conf).create()
File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 362, in app_context
APP, name=name, global_conf=global_conf)
File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 450, in get_context
global_additions=global_additions)