-2
\$\begingroup\$

Your function/program will receive an image as input and has to calculate the amount of rectangles within that image. Only a rectangle that is completely clean in the inside, meaning no other strokes dividing it, counts. The strokes will all be in any color other than white. The background will be white. The answer should either be printed or returned by your function/program.

Examples: image 1 image 2

Both those images should return 4 as answer, because there are 4 unique, undisrupted/undivided rectangles in each.

This is code golf, shortest answer in bytes wins!

\$\endgroup\$
9
  • 5
    \$\begingroup\$ You need to specify exactly the format of the input. \$\endgroup\$
    – graffe
    Sep 21 at 12:42
  • 1
    \$\begingroup\$ Does slanted rectangles count? \$\endgroup\$ Sep 21 at 12:47
  • 8
    \$\begingroup\$ Interesting idea, but this seems to be missing a lot of detail and specification which we expect from posts on this site; I recommend posting to the sandbox first, to get that sorted out before posting to main, and for other miscellaneous challenge quality feedback. \$\endgroup\$ Sep 21 at 12:48
  • 1
    \$\begingroup\$ Is it fine if I receive input as a series of binary numbers, where 1 means a pixel and 0 means no pixel \$\endgroup\$ Sep 21 at 12:49
  • 2
    \$\begingroup\$ I put this on hold so you have time to sort out the details before people start answering. I think this has the potential to be a good question, it just needs to be precise in what counts as a rectangle, and a little more precise in the input. \$\endgroup\$
    – Wheat Wizard
    Sep 22 at 11:17

0

Browse other questions tagged or ask your own question.