Caseware Interview Question

Leet code medium to easy. not hard problems