Dropbox interview question

code document.selectQuery from scratch.