This is my solution for instagram engineering challenge.