Solving some programming challenges