Google interview question

2 algorithm question on screen--easy to medium