Skip to main content
30 votes

Slash the matrix

MATL, 21 bytes 3XytPJ*-X*Xj~4&1ZIunq The input is a matrix with 1 for \ and ...
Luis Mendo's user avatar
  • 105k
29 votes

Weakened Binary Walls

MATL, 4 bytes BSXB Try it at MATL Online Explanation ...
Suever's user avatar
  • 11.1k
29 votes

Which tetromino is this?

Python 3, 124 bytes ...
lynn's user avatar
  • 68.8k
29 votes

Is there a single straight line in the matrix?

Python 2, 49 bytes Takes as input a 2D binary matrix \$ a \$, and its size \$ n \$. lambda a,n:sorted(map(sum,a+zip(*a)))[-2:]==[1,n] Try it online! There may be ...
dingledooper's user avatar
  • 22.7k
20 votes

Is it bipartite?

Wolfram Language (Mathematica), 26 25 bytes Tr[#//.x_:>#.#.Clip@x]<1& Try it online! How it works Given an adjacency matrix A, we find the fixed ...
Misha Lavrov's user avatar
  • 5,245
18 votes

To find islands of 1 and 0 in matrix

J, 57 bytes ,&([:(0#@-.~~.@,)](*@[*[:>./((,-)#:i.3)|.!.0])^:_ i.@$)-. Try it online! This is one of those where the idea is incredibly simple (and I ...
Jonah's user avatar
  • 33.6k
17 votes

To find islands of 1 and 0 in matrix

APL (Dyalog Unicode), 29 28 bytesSBCS -1 thanks to @Adám {≢∪∨.∧⍨⍣≡2>+/↑|∘.-⍨⍸⍵}¨⊂,~∘⊂ Try it online! ⊂,~∘⊂ the matrix ...
ngn's user avatar
  • 15.3k
16 votes

ASCII texturing

APL (Dyalog Unicode), 20 12 bytesSBCS -6 bytes through dzaima Full program. Prompts stdin for: texture as a list of strings number of rows in shape matrix number of columns in shape matrix indices ...
Adám's user avatar
  • 30.4k
16 votes

Just Enough Ones

J, 41 bytes 1#.*:=1#.2>[:>@~.@,[:+&,&.>/~i.@!<@A.=@i. Try it online! A different take on brute force, which handles up to n=6 on TIO. Since the ...
Jonah's user avatar
  • 33.6k
16 votes

Count my Pluses

MATL, 29 28 24 bytes z2Y6ttX*,GbZ+5Mz=z]yytvs Input is a binary matrix with 1 for '+' and <...
Luis Mendo's user avatar
  • 105k
15 votes

Is there a single straight line in the matrix?

Brachylog, 8 bytes {z|}≡ᵛ+1 Try it online! ...
Unrelated String's user avatar
14 votes

Decode Faux Braille

Python 3, 181 179 171 167 161 159 bytes Input by UTF-16 little-endian bytes without BOM. First decompose into columns using bit shifts, split by empty column, then hash them into a lookup table. -2 ...
Colera Su's user avatar
  • 2,421
14 votes

Mutually Attacking Queens

Python 2, 105 bytes lambda b:sum(b[i+d::d][:(8,7-i%8,i%8)[d%8%5]].find('1')*int(c)>0for i,c in enumerate(b)for d in[1,7,8,9]) Try it online! Explanation We ...
lynn's user avatar
  • 68.8k
13 votes

Finding Snakes in a Matrix

Python 2, 275 271 264 249 bytes Saved four bytes by replacing -1 with H and removing one slicing operation (...
Jonathan Frech's user avatar
13 votes

Is there a left-right connection?

MATLAB/Octave, 115 109 98* bytes -6 bytes thanks to Luis Mendo -7 bytes thanks to Luis Mendo ...
elementiro's user avatar
13 votes

Scribble Pad for Nerds

Vyxal, 4 bytes ×3ø^ Try it Online! 05AB1E, 3 bytes 3$Λ Try it online!
naffetS's user avatar
  • 12.5k
12 votes

Decode Faux Braille

JavaScript (ES6),  148 146 143  142 bytes Saved 1 byte thanks to @ngn ...
Arnauld's user avatar
  • 193k
11 votes

The Binary Square Diagonal Sequence

Husk, 15 14 bytes zȯḋm←CtNCİ□ṁḋN Try it online! Continually prints the results as an infinite list. Explanation I wonder whether there's a better way to get ...
Martin Ender's user avatar
11 votes
Accepted

Where is that snake going?

Wolfram Language (Mathematica), 16+83=99 bytes Library import statement (16 bytes): <<Combinatorica` Actual function body (83 bytes): ...
DELETE_ME's user avatar
  • 17.3k
11 votes

Trim that distracting background off!

MATL, 5 bytes JYaZy Try it online! Or verify all test cases. Explanation ...
Luis Mendo's user avatar
  • 105k
11 votes

Calculate COVID spread

Jelly, 10 bytes ŒJạ€ŒṪ§Ṃ€Ṁ Try it online! -2 bytes thanks to Sisyphus Calculate the Manhattan differences from all 0s to all 1s, and the answer is the maximum of ...
hyper-neutrino's user avatar
  • 42.4k
11 votes

Calculate COVID spread

Wolfram Language (Mathematica), 90 78 bytes f=Length@FixedPointList[ListConvolve[CrossMatrix@1,#,{2,2},0,Times,Max]&,#]-2& Try it online! -12 bytes, ...
imas145's user avatar
  • 261
11 votes
Accepted

Calculate COVID spread

Stencil , 2 bytes ×v Try it online! tallies the number of necessary steps (including ...
Adám's user avatar
  • 30.4k
11 votes

Is there a single straight line in the matrix?

Ruby, 47 bytes ->m,n{m.uniq[1]?m-[[0]*n]==[[1]*n]:m[0].sum==1} Try it online! Explain please: Split the two cases: If m has at least 2 different rows, remove ...
G B's user avatar
  • 22.1k
11 votes

Scribble Pad for Nerds

Charcoal, 9 bytes FA✳ι##‖↘# Try it online! Link is to verbose version of code. Explanation: FA Loop over the directions. ...
Neil's user avatar
  • 172k
10 votes

Braille graphics

Jelly,  31  30 bytes sz0Z ç€2ZF€ç€8Zœ?@€€-36Ḅ+⁽$ṁỌY Try it online! How? ...
Jonathan Allan's user avatar
10 votes

Change the rules of Life

MATL, 24 23 bytes xx:"tt3Y6Z+1Gm<8M2Gmb*+ Inputs are: Array with birth rule Array with survival rule Number of generations Matrix with initial cell ...
Luis Mendo's user avatar
  • 105k
10 votes

Mutually Attacking Queens

JavaScript (ES7), 86 bytes Takes input as an array of 64 integers with 254 for a queen and 0 for an empty square. ...
Arnauld's user avatar
  • 193k
10 votes

Where is that snake going?

Jelly, 12 11 bytes ŒṪŒ!ạƝ€§ÐṂL Try it online! Explanation. ...
DELETE_ME's user avatar
  • 17.3k
10 votes

Where is that snake going?

JavaScript (ES6), 154 134 bytes ...
Arnauld's user avatar
  • 193k

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