Box Stacking DP

Sir, unable to pass few test cases for the following code.

Either place all 6 variations of box or place 3 variations such that
boxes.push_back({h,max(l,w),min(l,w)});
boxes.pb({l, max(h,w), min(h,w)});
boxes.pb({w, max(l,h), min(l,h)});
this rules out those case where interchanging any two sides(except current height) makes the box stack condition valid.

1 Like