close
Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!.

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.

Question list filters

Filter by
Sorted by
Tagged with
Filter by Employee ID
Score of 11
17 answers
627 views

Objective Given a three-dimensional vector: $$ \mathbf{v} = \begin{bmatrix} a \\ b \\ c \end{bmatrix} $$ Output the following matrix: $$ \star\mathbf{v} = \begin{bmatrix} 0 & c & -b \\ -c &...
Score of 12
7 answers
2451 views

Do Not Find the Fox is a non-game where you repeat the following up to 16 times: Pick an empty square in a 4×4 grid Draw a tile from a bag – there are 5 Fs, 6 Os and 5 Xs at first – and place it in ...
Score of 23
11 answers
3986 views

Below are simplified versions of the flags of France, Netherlands and Poland respectively, as 9x6 pixels: See here for a plain text version. (Many other flags use this color scheme, but I think a ...
Score of 2
4 answers
327 views

This is about \$n\$ by \$n\$ binary matrices. Call a pair of rows unfriendly if the Hamming distance between the two rows is larger than the number ones they have in common positions. Let us call a ...
Score of 3
4 answers
660 views

There are 251610 6 by 6 binary matrices that are inequivalent. We say two matrices are equivalent if there is some permutation of their rows and/or columns that makes them equal. For example: ...
Score of 15
19 answers
2680 views

Hadamard matrices is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In other words, it means that each pair of rows has matching entries in exactly half of ...
Score of 12
6 answers
1788 views

Given three grids and the sum of rows and columns of each grid, your task is: Grid \$3×3\$: Fill the grid from \$1\$ to \$9\$, ensure no repeats within the grid. Grid \$4×4\$: Fill the grid from \$1\...
user avatar
Score of 12
7 answers
1592 views

Introduction Tensor contraction is an operation that can be performed on a tensor. It is a generalization of the idea of the trace of a matrix. For example, if we have a rank-2 tensor (a matrix) and ...
Score of 4
1 answer
716 views

Consider an \$n \times n\$ grid of integers. The task is to draw a straight line across the grid so that the part that includes the top left corner sums to the largest number possible. Here is a ...
Score of 9
5 answers
1203 views

There have already been challenges about computing the exponential of a matrix , as well as computing the natural logarithm of a number. This challenge is about finding the (natural) logarithm of ...
Score of 17
22 answers
2152 views

The unique-disjointness matrix ( UDISJ(n) ) is a matrix on all pairs of subsets of {1...,n} with entries $$ U_{(A,B)}=\begin{cases} 0, ~ if ~ |A\cap B|=1\\ 1, ~ ...
Score of 27
42 answers
2429 views

Diagonalize a vector into a matrix. Input A vector, list, array, etc. of integers \$\mathbf{v}\$ of length \$n\$. Output A \$n \times n\$ matrix, 2D array, etc. \$A\$ such that for each element \$a_i \...
Score of 1
0 answers
142 views

Suppose you have a grid of cells that is 6 wide and arbitrarily tall. In each cell is a word. Let the bottom row, which is row #1, be the last 6 words of sample.txt in order. Let the second to last ...
Score of 1
0 answers
143 views

I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition: An \$n\times n\$ consists of numbers \$1,2,\cdots, n^2\$. All numbers must be ...
Score of 24
29 answers
2261 views

Although it's done a few times as sub-challenge of a larger challenge, and we also have a challenge to remove the borders of a square matrix, I couldn't find a challenge to output the borders of a ...

15 30 50 per page
1
2 3 4 5
21