Optimizing Box Weights Hackerrank Solution Python Programming