GlowRoad interview question

Next permutation of a number, SQL queries, Design TinyURL.