Agorize Interview Question

Two case studies, not easy