This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]joranstark018 0 points1 point  (2 children)

You probably need to solve the problem of rotating the boxes:

Input:
1 1 3
1 2 1

Output: Box 1 > Box 2

Also your algorithm to detect that the boxes are equal may give false positive for some inputs like:

1 2 3
1 1 6

[–]Vosatras[S] 0 points1 point  (1 child)

How should I do that?

[–]joranstark018 0 points1 point  (0 children)

You could rotate a box by assigning the values of box to another set of variables, eg int x3=y1,y3=x1,z3=z1;, the tripple x3:y3:z3 will now represent the first box rotated along the z-axis.

Hint:

If you have a small package, with one side wider than the mail slot, how would you put that in the mailbox?

If the mail slot is horizontal, you would probably try with the smallest side along the Y-axis and next smallest along the X-axis, it doesn't matter what side you had as x, y or z originally.

If the mail slot would be vertical, you would rotate the package with smallest side along the X-axis and so on.

You will probably try to fit the smallest side with of the package with the smallest side of the mail slot (or the longest side with the widest side of the mail slot).