The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [geometry]

This challenge is intended to be solved by using, manipulating, or creating shapes or other geometric structures.

71 questions
Filter by
Sorted by
Tagged with
2k views

Cover a Region with Rectangles

Input Your input in this challenge is a list of integer pairs. They represent the southwest corners of unit squares on the plane, and the list represents their union as a subset of the plane. For ...
2k views

Output a Face on a Numbered Cube

Assign the numbers 0 through 7 to the 8 vertices of a cube in any way you want. Exactly one number must be assigned to each vertex. For example, your vertices might be assigned like this: ...
2k views

Partitioning the grid into triangles

Goal The goal of this challenge is to produce a function of n which computes the number of ways to partition the n X 1 grid ...
2k views

How Many Holes?

Challenge Given a graphical input of a shape, determine how many holes there are in it. Not Duplicate This question was marked as a possible duplicate of Count Islands. I believe this challenge is ...
1k views

Find the nearest clock hands

Challenge Given a number of seconds past midnight, output the smallest angle between any two hands on a clock face, using as few bytes as possible. You may assume that the number of seconds is ...
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 ...
402 views

Hilbertize an image

For a computer vision app I want to do a mapping of an image, in such a way that every pixel fit hilbert curve, instead of conventional layout. So task could be as follows: Task description Given ...
345 views

Find the longest uninterrupted arc

The challenge here is to find the longest uninterruped arc around a unit circle with a random amount of points distributed in random positions around it. Here is a diagram to assist my explanation: ...
1k views

The Star-Spangled Code Challenge

The flag of the United States of America contains, in its canton, 50 stars, representing the 50 states. In the past, when there were fewer states, there were of course fewer stars, and they were ...
667 views

Text on a circle

Write a program or function that prints an input string around the discrete circle that has the minimum possible radius. For example, for input This is an example, ...
3k views

Random Golf of the Day #4: The Bertrand Paradox

About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You ...
882 views

Overlapping circle

You should write a program or function that given an N by N equally spaced square grid and a solid inscribed circle outputs or ...
1k views

Print a Pentomino Rectangle

Write a program or function that takes no input but prints or returns a constant textual depiction of a rectangle made of the 12 distinct pentominoes: The rectangle may have any dimensions and be in ...
762 views

Euler-Poincaré-Characteristic of Polyhedra

Given a triangulation of the surface of a polyhedron p, calculate its Euler-Poincaré-Characteristic χ(p) = V-E+F, where ...
541 views

Counting generalized polyominoes

This challenge will have you count pseudo-polyforms on the snub square tiling. I think that this sequence does not yet exist on the OEIS, so this challenge exists to compute as many terms as possible ...
1k views

Area of a 2D convex hull

You are given an array/list/vector of pairs of integers representing cartesian coordinates $(x, y)$ of points on a 2D Euclidean plane; all coordinates are between $−10^4$ and $10^4$, duplicates ...
2k views

Create a grid as close to a square as possible

Create a function or program that makes a grid as close to an square as possible You will be given an integer N as input, whole numbers (1,2,3,25, etc) The output must be a perfect rectangular grid ...
318 views

Regions of regular polygons

Given a regular N-gon with all diagonals drawn, how many regions do the diagonals form? For example, a regular triangle has exactly 1, a square has exactly 4, pentagon has exactly 11, and a hexagon ...
306 views

Line through Polygon

Input: A line of the standard slope-and-intercept form: mx+b, as well as a set of Cartesian points determining the vertices of a polygon. Assume that the x and y ...