Skip to main content
34 votes

Solve Grid-Tangram

BBC BASIC, 570 514 490 bytes ASCII Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html 435 bytes tokenised Full program displays an input from ...
Level River St's user avatar
13 votes

Generate all Sublist Partitions

Retina, 27 19 bytes Byte count assumes ISO 8859-1 encoding. +1%`, ;$'¶$`];[ ; , Try it online! Explanation Of course this computes all partitions using string ...
Martin Ender's user avatar
13 votes

Partition a square grid into parts of equal area

JavaScript (ES7), 166 bytes Outputs a matrix of integers that describe the partition, or \$false\$ if there's no solution. ...
Arnauld's user avatar
  • 193k
12 votes

Partial factorisations of a positive integer

Haskell, 56 bytes _!1=[[]] i!n=[j:f|j<-[i..n],mod n j<1,f<-j!div n j] (2!) (2!)(1338557220::Int) prints in five ...
Anders Kaseorg's user avatar
12 votes

Count occurences of a set in a list

Python, 30 bytes lambda s,l:min(map(l.count,s)) Try it online!
ovs's user avatar
  • 59.5k
11 votes

Third Stirling numbers of the second kind

Jelly, 6 bytes 3Ḋ*)SI Try it online! -1 byte thanks to Jonathan Allan 1-indexed sequence without leading zeros. Uses the formula \$\sum_{k=1}^{n} 3^k - 2^k\$. ...
xigoi's user avatar
  • 7,281
11 votes

Find the fairest partition of a list

Python, 57 bytes f=lambda A,B,*a:min((z:=[abs,f][a>()])(A+B,*a),z(A-B,*a)) Attempt This Online! Takes splatted input. Input must have at least 2 elements. How? ...
loopy walt's user avatar
  • 16.7k
10 votes

Generate all Sublist Partitions

Pure Bash, 28 eval echo [${1//:/{:,]:[\}}] Here, lists are colon-separated, and contained in square brackets. For example in the question, the input list would ...
Digital Trauma's user avatar
10 votes
Accepted

Counting the number of restricted forests on the Möbius ladder of length n

CJam (58 56 chars) Some characters unprintable, and one is a tab which will be mangled by the StackExchange software: ...
Peter Taylor's user avatar
  • 43.1k
10 votes

Split a number in every possible way

Brachylog, 8 bytes ṫ{~cịᵐ}ᵘ Convert to string and get all unique {…}ᵘ reverse ...
xash's user avatar
  • 11.3k
10 votes

Write a set as a union of ranges

05AB1E, 13 12 bytes -1 thanks to @KevinCruijssen æʒ¥Ë}æé.Δ˜êQ Try it online! ...
Command Master's user avatar
10 votes

Find the fairest partition of a list

05AB1E, 7 5 bytes æOÂαß Attempt this online! or try all testcases Explanation Utilizes the fact that 05AB1E's powerset builtin returns the sets in the same order ...
Command Master's user avatar
9 votes

Third Stirling numbers of the second kind

Jelly, 7 bytes cþæ*2FS Try it online! Now that xigoi has outgolfed me, I thought I'd share my answer. This outputs the \$n\$ term of the sequence without leading ...
caird coinheringaahin g's user avatar
8 votes

Interquartile Mean

Pyth, 11 10 bytes .O><lQS*4Ql .OsPtc4S*4 Test suite. How it works It quadruplicates the input list to ensure that the data count is divisible by 4. It still needs sorting, because ...
Leaky Nun's user avatar
  • 49.8k
8 votes

Interquartile Mean

MATL, 12 11 bytes 4Y"G"6L)]Ym Input is a horizontal vector, with the format [1, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 38] or ...
Luis Mendo's user avatar
  • 105k
8 votes

Split a list into sized chunks, but not counting items failing predicate

Brachylog, 37 bytes hW&t~c.k{↰₂ˢl}ᵐ;WxĖ∧.bhᵐ↰₂ᵐ∧.t↰₂ˢl≤W∧ Try it online! I was pleasantly surprised to find that this - pretty much a restatement of the ...
Sundar R's user avatar
  • 6,612
8 votes

Split a list into sized chunks, but not counting items failing predicate

Apl (Dyalog Unicode) 17 16 bytes (SBCS) Thanks to Adám for saving me 1 byte. w⊆⍨⌈⎕÷⍨1⌈+\⎕¨w←⎕ Try it online! for explaination purposes I will leave up the 17 byte ...
jslip's user avatar
  • 791
8 votes

Split a number in every possible way

05AB1E, 4 bytes .œïÙ Try it online! Explanation ...
Expired Data's user avatar
  • 4,001
8 votes

Is it a vampire number?

Husk, 18 17 14 13 12 bytes Edit: -3 bytes, and then another -1 byte, thanks to Leo, and -1 byte thanks to inspiration from pajonk's R answer (3rd edit) €¹mΠ†dm½f→Pd ...
Dominic van Essen's user avatar
8 votes

Third Stirling numbers of the second kind

R, 23 bytes 3^(n=scan()+2)/2-2^n+.5 Try it online! Outputs without the leading zeros, 0-indexed. Uses formula from OEIS page: $$ a(n) = 9 \cdot 3^n/2 - 4 \cdot 2^...
pajonk's user avatar
  • 16.7k
8 votes

Divisible subset sums

JavaScript (ES6), 40 bytes Expects (k)(n). k=>g=(n,s=0)=>n--?g(n,s)+g(n,s-~n):s%k<1 Try it online! Commented ...
Arnauld's user avatar
  • 193k
8 votes

Divisible subset sums

Python 3, 54 bytes f=lambda n,k,r=0:n and f(n-1,k,r)+f(n-1,k,r-n)or r%k<1 Try it online!
att's user avatar
  • 20.6k
8 votes

Cut along the lines

K (ngn/k), 22 bytes {(&'+1,!2-1_=':x)_\:x} Try it online! 1_=':x For pairs of adjacent values: are they equal? ...
ovs's user avatar
  • 59.5k
8 votes

Incomparable partitions

Retina 0.8.2, 7 bytes T`,;`;, Try it online! Takes input and output as a semicolon-delimited list of comma-delimited lists. Explanation: Simply partitions the ...
Neil's user avatar
  • 172k
8 votes

Is this substring list ambiguous?

JavaScript (ES6), 110 bytes Returns false for unambiguous or true for ambiguous. ...
Arnauld's user avatar
  • 193k
8 votes

Is this substring list ambiguous?

Python, 104 bytes f=lambda l,x=set():l>l-(y:={a[len(b):]for a in l|x for b in[l,l|x][{a}<l]if b+"~">a>b})or y-x and f(l,y) Attempt This ...
loopy walt's user avatar
  • 16.7k
7 votes

Partial factorisations of a positive integer

Pyth, 29 bytes ...
Anders Kaseorg's user avatar
7 votes

Split a grid into a grid

Pyth, 30 29 26 24 23 bytes sm.Asmmq1ssbCkds./MC./M Try it online. I'm sure this will get shorter. This is O(2mn), where m and n are the width and height of the ...
PurkkaKoodari's user avatar
7 votes

How many partitions contain only perfect squares?

Jelly, 8 bytes ŒṖḌƲẠ€S A monadic link taking a list of digits and returning a non-negative integer. Try it online! or see the test suite. How? ...
Jonathan Allan's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible