# Questions tagged [matrix]

This tag is for challenges involving matrices. A matrix, also known as a 2D array, is a list of numbers arranged in a rectangle with rows and columns.

274 questions
Filter by
Sorted by
Tagged with
2k views

### Reconstruct Matrix from its diagonals

Given the diagonals of a matrix, reconstruct the original matrix. The diagonals parallel to the major diagonal (the main diagonals) will be given. Diagonals: ...
• 4,871
1k views

### Flood fill by distance

Say I have a grid with some obstacles: ---- | X | | | |XX | | | ---- I can fill this with numbers, as distance from the top left corner. But, because ...
• 31.9k
2k views

### Create Bernard from Desmos

Background In the online graphing calculator Desmos, there is a certain shape that appears in the lower left portion of the graph in many high detail graphs, which the Desmos community has dubbed &...
• 8,416
1k views

### fastest matrix multiplication on x86

This challenge requires integration with C, so you can stop reading if you're not interested. Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code ...
• 2,273
339 views

### center a matrix [closed]

The words "center a" probably give flashbacks to any decent HTML developer. Luckily, we are not working with divs, we are working with matrices. Given a matrix where w=h, and given a "...
• 691
1k views

### Storing a band matrix

Related challenge A band matrix is a matrix whose non-zero entries fall within a diagonal band, consisting of the main diagonal and zero or more diagonals on either side of it. (The main diagonal of a ...
• 34.3k
975 views

• 1,654
1k views

### Drop down the numbers

This was inspired by Apply gravity to this matrix Your challenge is to input a matrix with non-negative one-digit integers and drop down the 1's down 1 column, the 2's down 2 columns, the 3's down 3 ...
• 3,129
3k views

### Apply gravity to this matrix

This was inspired by this question. Given an $m\times n$ matrix of $0$'s and $1$'s, apply "gravity" to it. This means to drop down all the $1$'s as if they were affected by gravity. ...
• 799
587 views

### Calculate the integer square root of a matrix

Let $A$ be a square matrix that is at least $2 \times 2$ where each element is an integer. $A^2 = A \times A$ will then have the same dimensions as $A$, and will have integer elements. For ...
2k views

• 22.6k
2k views

### Count my Pluses

Your task is, to count how many pluses I have. What Pluses? The no plus: 0 Points - The naïve Plus: 1 Point + The double ...
• 4,871
1k views

### Drop some boxes

Say I have a pile of boxes: AAA BBB I can create it in two steps: BBB ↓ (empty) --- AAA ↓ BBB But with this: ...
• 31.9k
804 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 (...
• 31.9k
2k views

### Is it a valid Parker Square

5 Years ago, this happened, and then it became sort of a meme. Challenge The Challenge today is, to check if a "magic square" is a valid parker square. What is a Real Magic square? All the ...
• 4,871
2k views

### Generate this number table

Given an integer $1 < n < 10$ generate a table like below. For $n = 5$, 1 2 3 4 5 2 2 3 4 5 3 3 3 4 5 4 4 4 4 5 5 5 5 5 5 For $n = 8$, ...
• 421
769 views

### Construct a Modulo Multiplication Table

Consider a n x n multiplication table and replace each item with its remainder of division by n. For example, here is a ...
• 1,025
3k views

### I'm Lazy*: Top-left align my text

* and don't have a word processor with top-left align support :D Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be ...
• 1,450