Linked Questions
10 questions linked to/from Zigzagify a Matrix
39 votes
54 answers
4k views
Boustrophedonise
Related but very different. A boustrophedon is a text where every other line of writing is flipped or reversed, with reversed letters. In this challenge, we will just reverse every other line, but ...
27 votes
27 answers
3k views
Diamondize a Matrix
Given a matrix, output a representation of the matrix where the top left element is on top, the anti-diagonal is the central row and the bottom right element is at the bottom. For example, consider ...
34 votes
10 answers
3k views
Rotate the anti-diagonals
Background In most reasonable programming languages, it's very easy to rotate the rows or columns of a 2D array. In this challenge, your task is to rotate the anti-diagonals instead. Recall that the ...
22 votes
10 answers
2k views
Traverse a rectangle's antidiagonals
There exists a bijection between the natural and rational numbers that works (approximately) like this: You create a 1-indexed 2-dimensional grid. In every field of this grid with position ...
16 votes
12 answers
2k views
Is this a shift matrix?
A Shift matrix is a binary matrix with one superdiagonal or subdiagonal formed by only ones, everything else is a zero. A superdiagonal/subdiagonal is a diagonal parallel to the main diagonal, which ...
19 votes
8 answers
2k views
Hilbert-Curvify a Matrix
Inspired by this question Another way to unroll a 2D image into a 1D string is to use an Hilbert Curve. There are many version of this curve, depending on the number of iterations used while ...
14 votes
9 answers
976 views
Number the positive rationals
The positive rational numbers can be shown to be numerable with the following process: Zero has the ordinal 0 Arrange the other numbers in a grid so that row a, column b contains a/b Plot a diagonal ...
24 votes
4 answers
1k views
Reconstruct a zigzagified matrix
As part of its compression algorithm, the JPEG standard unrolls a matrix into a vector along antidiagonals of alternating direction: Your task is to take the unrolled vector along with the matrix ...
16 votes
5 answers
570 views
Word Search Helper
I've been doing word searches recently, and I thought it would be so much easier if all of the words read left-to-right. But rewriting all the lines takes a lot of effort! So I'm enlisting code ...
4 votes
0 answers
96 views
Zigzag a string [duplicate]
A zigzag scan is a method of encoding 2D information in one dimension: Write a function or program that, given a one-dimensional string of printable ASCII characters, will reverse the zigzag scan to ...