Independent Units in an Array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Independent Units in an Array

An array (let 20*20) inputs either B or W. Imagine the array to be the grids of a graph paper. B implies that grid (let 4*5) be black in colour and W means the grid is white in colour. The compiler categories each black grid as one unit. If multiple black grids occur adjacent to each other (only top bottom left and right)(diagonally not counted) , be it in the shape of rectangle or square or maybe T shaped, the complete structure is counted as one unit. So the program has to find how many such black independent units are there.

29th Aug 2018, 5:10 PM
Yash Gutgutia
Yash Gutgutia - avatar
3 Answers
+ 1
Yash Gutgutia please don't expect people to code for you entirely...show your code and let people know where you are stuck...
29th Aug 2018, 6:01 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Yash Gutgutia it's okay... this is question answer section..only coding related question is to be asked here. if you wish, you can have this type of details on your activity feed or either you can submit assignment
30th Aug 2018, 1:21 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Ketan Lalcheta Hi. Sorry I am new to the platform. I do not wish someone to solve it for me. Just that I found the problem interesting and wanted to share wid people.
29th Aug 2018, 7:08 PM
Yash Gutgutia
Yash Gutgutia - avatar