Loblaw Digital Interview Question

try solving the leetcode medium