Turing Interview Question

2 coding challenges , one from easy and another form medium