GammaStack interview question

Some data structure and algorithm puzzles from GeeksforGeeks