We are trying to create a video game in which aliens are attacking a friendly base. You can imagine the base to be a 1D line that goes from 0 to 10.
The alien’s attack length is always 1, but it can choose to attack anywhere along the base. We would like to implement two functions for the video game: attack and is_game_over.
For the attack function, it takes a number from 0 to 10 and should mark the corresponding place to start the attack. For example, if attack is called with 3, then the line subset 3-4 should be marked as destroyed.
For the is_game_over function, it should return a boolean, which specifies whether or not the entire base has been destroyed.
This problem asks you to track destruction on a 1D base from 0 to 10. Each `attack(x)` marks the unit segment starting at `x` as destroyed, and `is_game_over()` checks whether every segment of the base has been destroyed. A simple and effective approach is to use a boolean array or bitset to record covered positions and verify full coverage when queried.