Optimal gift wrapping
Sam, who lives in a two dimensional world, has bought his wife n
gifts for the holidays. Having spent most of his money already, he'd like to spend as little as possible on wrapping string.
Each gift has the shape of a unit square. Write a program which, given n
, outputs the minimum length of wrapping string Sam needs to wrap all n
gifts.
If that's not challenging enough for you, try the same problem in three dimensions, or d
dimensions.