703 Gaming, inc. has released a new game called TopCraft. In this game, an army
of coding professionals must attack the evil bugs infesting the world. These
coding professionals (referred to in game terminology as "units") are
classified as either division 1 or division 2 units.
In order to control units, the player must drag a selection rectangle across
the screen. Any units encompassed by the rectangle get selected for control.
Stan Ford has just bought this game to kill time. Now he's stuck in a position
where he has to attack the evil bugs as fast as he can. To accomplish this, he
wants to select all of the division 1 units on his screen with as few selection
rectangles as possible, but without selecting any division 2 units in the
process. Write a method that, given the screen configuration, returns the
minimum number of selection rectangles necessary to select all of the division
1 units.
The screen will be represented by a String[] with 10 elements, each of length
10. Each character will be either a '.' for a clear space, a '1' for a
division 1 unit, or a '2' for a division 2 unit.
|