Coding interview solutions in Python