DFI Retail Group interview question

Problem solving some task online