PharmEasy interview question

Matrix based question ( leetcode medium )