Hackerank data sruvtures

Can you please tell just the approch of this problem

image

Reference Code