CARVIEW |
Select Language
HTTP/2 200
date: Mon, 28 Jul 2025 08:51:47 GMT
content-type: text/html; charset=utf-8
cf-ray: 966322fd1e7d3e92-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=b9a51853-b163-4633-a15d-bc6fee3d88f0; expires=Tue, 28 Jul 2026 08:51:47 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: 62d5c9ab-db38-4a77-b249-d45ffa61faa2
x-worker-origin-response-time: 415000000
x-dns-prefetch-control: off
set-cookie: prov=b9a51853-b163-4633-a15d-bc6fee3d88f0; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=wOgf.E7Os_1lPdInmFmAaew.83DnaWzt2Jd6VS43bGc-1753692707-1.0.1.1-Wf44.milVhHxbjIqBerQuTXIvXFz1jF6molbaFxCV30iG7VZb2cNyk3W3kbWYiKSfFkXacS07KHUE0dPVdAfubKFPB3OVMRCe7448FbJy6g; path=/; expires=Mon, 28-Jul-25 09:21:47 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=U9HlBcRETZpEkDI9saoGkJMuCUQhI2UuVV53e4337qE-1753692707823-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'set-partitions' Questions - Code Golf Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions tagged [set-partitions]
For challenges related to the subdivision of a set into smaller disjoint sets. This also includes the subdivision of ordered collections like lists, and non-discrete sets like intervals. Challenges should carefully define the partition concept being used.
64 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
23
votes
10
answers
2k
views
Half Price for Every Second Pizza
PizzaTata is a popular restaurant specializing in pizza delivery. Customers can order pizzas by phone. And each order is charged by the sum of pizza prices and the delivery fee.
Pizza Prices: The ...
7
votes
8
answers
945
views
Solve the "word break problem" in a single line of code
Challenge
Solve this problem in the fewest number of bytes of code possible.
Write code that takes a string \$str\$ and a dictionary-list of words \$d\$ and finds all combinations of words from \$d\$ ...
11
votes
8
answers
1k
views
Night hike partitioning
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens ...
16
votes
19
answers
2k
views
Find the fairest partition of a list
Given a list of positive integers, partition the list into two sublists such that the absolute value of the difference of the sums over the two sublists is minimal.
The output of the program should be ...
6
votes
7
answers
3k
views
Help, I can't bloody well memorize this number!
The Brits aren't exactly known for being good at memorizing stuff. That's why scientists need newspaper articles to find those who are, and that's why it shouldn't be a surprise that they forget more ...
22
votes
8
answers
2k
views
Write a set as a union of ranges
In this challenge, we define a range similarly to Python's range function: A list of positive integers with equal differences between them. For example, ...
8
votes
6
answers
273
views
Minimum partition with non-empty intersections
Given a set of intervals \$\mathcal{I} = \{I_1, \ldots, I_m\}\$, where each interval \$I_j\$ is represented by its bounds \$(a_j, b_j)\$, find a partition \$\mathcal{T}\$ of \$\mathcal{I}\$ of minimal ...
19
votes
9
answers
1k
views
Is this substring list ambiguous?
Given a set of substrings, such as [ca, ar, car, rd], it's possible to create infinitely many strings by concatting them together. Some examples of this for the ...
7
votes
9
answers
379
views
Incomparable partitions
A partition of a list \$A\$ is a way of splitting \$A\$ up into smaller parts, concretely it is list of lists that when concatenated gives back \$A\$.
For example ...
21
votes
20
answers
2k
views
Cut along the lines
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty ...
16
votes
16
answers
1k
views
Divisible subset sums
Inspired by the recent 3Blue1Brown video
Consider, for some positive integer \$n\$, the set \$\{1, 2, ..., n\}\$ and its subsets. For example, for \$n = 3\$, we have
$$\emptyset, \{1\}, \{2\}, \{3\}, \...
15
votes
28
answers
2k
views
There's more than one way to skin a set
Given a set of positive integers \$ S \$, output the set of all positive integers \$ n \$ such that \$ n \$ can be made by summing a subset of \$ S \$ in more than one different way, i.e., that are ...
12
votes
24
answers
2k
views
Third Stirling numbers of the second kind
\$\left\{ n \atop k \right\}\$ or \$S(n, k)\$ is a way of referring to the Stirling numbers of the second kind, the number of ways to partition a set of \$n\$ items into \$k\$ non-empty subsets. For ...
16
votes
17
answers
881
views
Square chunk my matrix
Your challenge is to write a function/program that takes a matrix of integers m and a number n as input and:
Splits m into n by n chunks
Replaces each chunk with the most common value in that chunk (...
6
votes
1
answer
314
views
The number of tilings of a grid
Setup:
A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid.
...
Welcome to Code Golf and Coding Challenges Stack Exchange! This is a site for recreational programming competitions, not general programming questions. Challenges must have an objective scoring criterion, and it is highly recommended to first post proposed challenges in the Sandbox.
- The Overflow Blog
-
-
- Featured on Meta
-
-
Related Tags
code-golf × 62
combinatorics × 17
math × 8
number × 7
grid × 7
array × 6
sequence × 6
decision-problem × 5
string × 5
number-theory × 4
geometry × 4
arithmetic × 3
subsequence × 3
primes × 2
tiling × 2
statistics × 2
restricted-time × 1
topology × 1
graph-theory × 1
matrix × 1
palindrome × 1
optimized-output × 1
more related tags
Hot Network Questions
- Do a linearly sloped electric field and uniformly increasing magnetic field satisfy Maxwell's Equations? An apparent paradox
- What is the grammar of が after an い-adjective?
- Why did the Holy Spirit send Jesus to the wilderness to be tempted by Satan?
- How does one justify the rationality of buying insurance?
- Why is Donald Trump portrayed like a Canadian in South Park S27E01?
- How can my dwarves keep humans from reverse engineering their technology?
- On coffee half and half and foam
- Dynamics from iterated averaging
- How to place a single nodes near coords label higher in pgfplots bar plot?
- Why does Timor-Leste call itself a "Democratic Republic" despite little apparent Marxist-Leninist ideology?
- What is this under cabinet lamp style? Are they easily convertible to LED?
- Sci-fi novel human-centered, with alien empire using stargates, humans try to avoid overruling
- Will this work as an XOR gate?
- The puzzle of chess pieces beating one another in “rock—paper—scissors” way
- Can one re-program a Leonardo Eth via its Ethernet port only?
- Heretofore I think I have been using 'heretofore' incorrectly
- A national poll of 1000 French returns 25% of "Yes". Is it enough to say that it's quite impossible locally to be 0%, if we don't know the variance?
- In Jurassic Park, is the lysine dependency intentionally fake (in-universe)?
- What is the proper course of action when a published paper utilizes my previously published methodology without providing citation?
- Will an error in two of my published papers affect my PhD thesis evaluation?
- Can you identify this aircraft landing at Llanbedr Airfield?
- Who has faced the country of winning and losing?
- Will a reinforced 1" concrete slab be durable?
- Why aren't there baleen whales at about the size of a dolphin?