The 2024 Developer Survey results are live! See the results

# Questions tagged [packing]

For challenges regarding fitting the most number of a certain shape into another shape, or for packing a number of a certain shape into the most compact form.

19 questions
Filter by
Sorted by
Tagged with
270 views

### CGAC2022 Day 22: Present stack headache, Part 2

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Santa has a bunch of presents wrapped in cuboid boxes of various sizes. As his sled flies above a chimney, a stack ...
• 78k
424 views

### CGAC2022 Day 21: Present stack headache

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. challenge idea by emanresu A Santa has a bunch of presents wrapped in cuboid boxes of various sizes. As his sled ...
• 78k
336 views

### Packing Cuboid Boxes into the Shortest Stretchy Truck

You are a package handler for Big CompanyTM and your job is to load boxes into a truck. These are special, stretchy trucks: their length can be adjusted at will. But stretching trucks are expensive, ...
• 10.3k
2k views

### Placing circles along a square spiral

In this code golf challenge, you'll be computing the placement of (open) circles of areas $\pi, 2\pi, 3\pi, \dots$ when greedily placed along integer points in a square spiral in such a way that no ...
• 8,689
459 views

### Find the area of the smallest rectangle to contain squares of sizes up to n

This is a sequence question of the usual type, as applied to OEIS sequence A038666. That is, do either of the following: Accept no or any input, and output A038666 until the heat death of the ...
• 3,453
408 views

### Tiling the unit square

Background By expanding and cancelling terms, it is easy to show the following identity: However, it is an open problem whether all 1/n-by-1/(n+1) rectangles can tile the unit square. The Task Your ...
• 3,839
2k views

### ASCII Bookshelves

You know those stackable shelves that are basically just wooden boxes that can be stacked together? We're going to simulate building some bookshelves out of those with some ASCII art. Our books are ...
• 43.5k
350 views

### Do the figures fit?

Challenge Make the shortest program to determine if the figures in the input will fit into the space in the input. Requirements The input will be in the format of this example: Input: ...
• 479
194 views

### Compute the polyomino capacity of a rectangle

Write a program or function that takes as input three positive integers x, y, and a and ...
• 555
890 views

### Packing Circles

Take a look at this image. Specifically, at how the holes on the ends are arranged. (Image source) Notice how the pipes in this image are packed in a hexagonal pattern. It is known that in 2D, a ...
2k views

### Stacking Pythagorean Triangles

Background A Pythagorean triangle is a right triangle where each side length is an integer (that is, the side lengths form a Pythagorean triple): Using the sides of this triangle, we can attach two ...
• 5,480
1k views

### Worst Case Manhattan Exclusion

Imagine a W by H grid of squares that wraps toroidally. Items are placed onto the grid as follows. The first item can be placed on any square, but subsequent items must not be within a Manhattan ...
446 views

### Packing Wood Pieces

There are two pieces of wood. Both consist of a straight body and some extra blocks below the body. An example piece with extra blocks at (0-indexed) positions 0,4,7,9,10: ...
• 20.9k
335 views

### Finding Symmetries in Squares

Write a program or function that takes in a list of positive integers. Each of these integers represents the side length of a square on a 2D plane. Each square can be moved to any integer coordinates ...
• 89.9k
1k views

### Tetris Tangrams

Introduction Tangrams are a classic puzzle involving arranging/fitting blocks into various shapes. From the Chinese 七巧板 - literally meaning "seven boards of skill". Let's take this idea ...
• 1,969
544 views

### Robot roadie needed to pack the truck

As the band's roadie, you have to pack the truck. Your program will place the packages so that they fit in the smallest height. A badly packed truck Rules Packages may be rotated through multiples ...
• 6,782
2k views

### Circle packing in a rectangle

Your task is to write a program that finds the largest radius that N circles can have and still fit inside of a rectangle that is X by Y pixels large. (similar to this wikipedia article) Your program ...
• 59.3k
3k views

### Solve a Tetris Puzzle (pack predefined shapes into optimal form)

The challenge is about finding an optimal solution on how to place a number of given shapes. It is oriented on the principle of Tetris, where it is optimal to pack the given pieces as tight as ...
• 183