Turing interview question

2 coding challenges , one from easy and another form medium