Questions tagged [binary-matrix]
Indicates that the challenge involves the manipulation of binary matrices, matrices whose elements are all one of two possible values, typically 1 and 0, or True and False.
69
questions
1
vote
3
answers
299
views
Yin-Yang Table Generator [closed]
I want an n*n table that is filled with black or white and the following conditions are satisfied in it:
All cells of a 2*2 square in this table should not be the same color.
All black and white ...
16
votes
7
answers
1k
views
Largest Binary Area
Take the sequence of all natural numbers in binary, (1, 10, 11, ..) then write them vertically beside each-other like this (least significant bit on top; 0s have ...
11
votes
9
answers
657
views
Find Sub-matrix with matched cell 1
You are given a matrix of size m x n where each cell can contain either 1 or 0. You need to find the largest square submatrix that contains only 1's. The output should be the area of the largest ...
16
votes
12
answers
1k
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 ...
13
votes
8
answers
1k
views
Toggle some bits and get an actual square
Inspired by the title of the Toggle some bits and get a square challenge.
In that challenge you output how many bits should be toggled, in order for the base-10 representation of the binary to become ...
11
votes
14
answers
2k
views
CGAC2022 Day 5: Preparing an advent calendar
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red ...
15
votes
14
answers
1k
views
1 to N column and row sums
Inspiration
There is a problem on the most recent AMC 12B test, the one held on November 16, 2022, which goes like this:
(AMC 12B 2022, Question 17)
How many \$4\times4\$ arrays whose entries are \$0\...
21
votes
6
answers
2k
views
For xor Young (15+)
A Young diagram is a rectangular binary mask whose every row and every column are sorted in descending order.
It is easy to check that every rectangular binary mask can be formed by xor-ing together a ...
23
votes
6
answers
994
views
Tic, Tac, stub your Toe
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically.
This is a ...
17
votes
8
answers
2k
views
Scribble Pad for Nerds
aka. implement an easier version of 05ab1e's canvas element.
Description
The canvas element is used to draw ASCII lines on the screen.
The (easier version of the) canvas element takes a list of ...
19
votes
7
answers
2k
views
Matrix Meets ASCII Art
A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is 0.
For example, the array ...
14
votes
7
answers
1k
views
Euler characteristic of a binary matrix
A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is <...
19
votes
7
answers
1k
views
Expand a matrix goo-ily
Input
An \$m\$ by \$n\$ binary matrix, with \$m\$ and \$n\$ both at least 2.
Think of the ones as gobs of melted cheese, which stretch as we expand the matrix horizontally and vertically.
More ...
6
votes
2
answers
398
views
Reveal all clues of Black Box
Black Box is a board game, Your task is to reveal all clues.
What is black box
Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues.
I/O
Input
The atoms ...
22
votes
6
answers
808
views
Check if a matrix is Zarankiewicz-maximal
My final-year project at the National University of Singapore is on Zarankiewicz's problem:
What is the maximum number of 1s in an \$m×n\$ binary matrix (\$m\$ rows and \$n\$ columns) with no \$a×b\$ ...