Upwind interview question

2 medium lit code questions