Code for instagram engineering challenge