Skip to main content
Fix broken test cases
Source Link
.  .

..  ..

.#  #.

.#  .#
..  ..

.#  #.
#.  .#

..#  ...
...  ...
.#.  ...

.......  .......
##.....  .......
#.....#  .......
.....##  .......

....##.  ....##.
##..##.  ....##.
#.....#  .......
.....##  .......

#.....###.  ..........
#.......#.  ..........
##...##...  ..........
.....##...  ..........
##........  ..........
##..####..  ....####..

.......###  .......###
..##..####  ......####
..#..###.#  .....#####
....###..#  ....######
...#######  ...#######

.......###  #######...
.##...####  ######....
.#...###.#  #####.....
....###..#  ####......
...#######  ###.......

........####  ########....
.###...#...#  #######.########....
.#..#.#.##.#  ##..##..##..
.###.###...#  #########........
....########  ####........

........####  ########....
.###...#...#  #######.########....
.#..#.#....#  ##..##......
.###.###...#  #########........
....########  ####........

test cases with colour codingtest cases with colour coding

.  .

..  ..

.#  #.

.#  .#
..  ..

.#  #.
#.  .#

..#  ...
...  ...
.#.  ...

.......  .......
##.....  .......
#.....#  .......
.....##  .......

....##.  ....##.
##..##.  ....##.
#.....#  .......
.....##  .......

#.....###.  ..........
#.......#.  ..........
##...##...  ..........
.....##...  ..........
##........  ..........
##..####..  ....####..

.......###  .......###
..##..####  ......####
..#..###.#  .....#####
....###..#  ....######
...#######  ...#######

.......###  #######...
.##...####  ######....
.#...###.#  #####.....
....###..#  ####......
...#######  ###.......

........####  ########....
.###...#...#  #######.....
.#..#.#.##.#  ##..##..##..
.###.###...#  #####.......
....########  ####........

........####  ########....
.###...#...#  #######.....
.#..#.#....#  ##..##......
.###.###...#  #####.......
....########  ####........

test cases with colour coding

.  .

..  ..

.#  #.

.#  .#
..  ..

.#  #.
#.  .#

..#  ...
...  ...
.#.  ...

.......  .......
##.....  .......
#.....#  .......
.....##  .......

....##.  ....##.
##..##.  ....##.
#.....#  .......
.....##  .......

#.....###.  ..........
#.......#.  ..........
##...##...  ..........
.....##...  ..........
##........  ..........
##..####..  ....####..

.......###  .......###
..##..####  ......####
..#..###.#  .....#####
....###..#  ....######
...#######  ...#######

.......###  #######...
.##...####  ######....
.#...###.#  #####.....
....###..#  ####......
...#######  ###.......

........####  ########....
.###...#...#  ########....
.#..#.#.##.#  ##..##..##..
.###.###...#  ####........
....########  ####........

........####  ########....
.###...#...#  ########....
.#..#.#....#  ##..##......
.###.###...#  ####........
....########  ####........

test cases with colour coding

added 23 characters in body
Source Link

Switch the colour of the largest non-unique connected shape

  • A rectangular grid of cells, each of which has 1 of 2 distinct values ("colours")
  • You can choose to accept any of
  • A shape is unique if no other shape is identical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest area, of those that are non-unique
  • If 2 or more distinct shapes are non-unique and have the largest area, all copiesinstances of each distinct shape must be changed
  • If there are no non-unique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours

Switch colour of largest non-unique connected shape

  • A rectangular grid of cells, each of which has 1 of 2 distinct values
  • You can choose to accept any of
  • A shape is unique if no other shape is identical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest area, of those that are non-unique
  • If 2 or more distinct shapes are non-unique and have the largest area, all copies of each distinct shape must be changed
  • If there are no non-unique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours

Switch the colour of the largest non-unique connected shape

  • A rectangular grid of cells, each of which has 1 of 2 distinct values ("colours")
  • You can choose to accept any of
  • A shape is unique if no other shape is identical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest area, of those that are non-unique
  • If 2 or more distinct shapes are non-unique and have the largest area, all instances of each distinct shape must be changed
  • If there are no non-unique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours
Remove misleading use of "remove"
Source Link

RemoveSwitch colour of largest non-unique connected shapesshape

Given a rectangular grid of square cells, find the non-unique connected shapes with the largest area, and remove all copiesswitch their colour

The 2 distinct values will be referred to as "colours", but the rules apply similarly for all of the permitted formats

Let me know if there is an alternative format you would like to be considered

  • A rectangular grid of cells in the same format as the input, using the same 2 distinct valuescolours
  • For each shape required to be changed, all of its cells have been switched to the other of the 2 distinct valuescolour
  • translation
  • rotation by an integer multiple of 90 degrees
  • reflection in any vertical or horizontal line
  • reversingswitching its colour
  • A shape is unique if no other shape is identicalidentical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest areaarea, of those that are non-uniqueunique
  • If 2 or more distinct shapes are non-uniqueunique and have the largest areaarea, all copies of each distinct shape must be changed
  • If there are no non-uniqueunique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours

WithThe same test cases with colour coding for human reading (click image for larger version):

  • This is
  • Your score is the number of bytes in your source code
  • For each language, the code with the lowest score wins

This is . Your score is the number of bytes in your source code. For each language, the code with the lowest score wins

Remove largest non-unique connected shapes

Given a rectangular grid of square cells, find the non-unique connected shapes with the largest area, and remove all copies

The 2 distinct values will be referred to as "colours", but the rules apply similarly for all of the permitted formats

Let me know if there is an alternative format you would like to be considered

  • A rectangular grid of cells in the same format as the input, using the same 2 distinct values
  • For each shape required to be changed, all of its cells have been switched to the other of the 2 distinct values
  • translation
  • rotation by an integer multiple of 90 degrees
  • reflection in any vertical or horizontal line
  • reversing its colour
  • A shape is unique if no other shape is identical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest area, of those that are non-unique
  • If 2 or more distinct shapes are non-unique and have the largest area, all copies of each distinct shape must be changed
  • If there are no non-unique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours

With colour coding for human reading (click image for larger version):

  • This is
  • Your score is the number of bytes in your source code
  • For each language, the code with the lowest score wins

Switch colour of largest non-unique connected shape

Given a rectangular grid of square cells, find the non-unique connected shapes with the largest area, and switch their colour

The 2 distinct values will be referred to as "colours", but the rules apply similarly for all of the permitted formats

  • A rectangular grid of cells in the same format as the input, using the same 2 colours
  • For each shape required to be changed, all of its cells have been switched to the other colour
  • translation
  • rotation by an integer multiple of 90 degrees
  • reflection in any vertical or horizontal line
  • switching its colour
  • A shape is unique if no other shape is identical to it
  • The area of a shape is the number of cells it contains
  • The shapes to be changed are those with the largest area, of those that are non-unique
  • If 2 or more distinct shapes are non-unique and have the largest area, all copies of each distinct shape must be changed
  • If there are no non-unique shapes, the output is the same as the input
  • A grid (input or output) may sometimes contain only 1 of the 2 colours

The same test cases with colour coding for human reading (click image for larger version):

This is . Your score is the number of bytes in your source code. For each language, the code with the lowest score wins

deleted 1 character in body
Source Link
Loading
deleted 3 characters in body
Source Link
Loading
Source Link
Loading