Duolingo Interview Question

2 questions in OA, string and graph problems.