HARMAN Interview Question

logic wise