Option (D) is correct.
Explanation: In the Regular Polygons sequence the number of sides goes 3, 4, 5, 6, 7, … A polygon has as many corners as it has sides. So the beds have 3, 4, 5, 6 and 7 corners:
3+4+5+6+7=25
There are 25 lamps.
Why the other options are wrong
- (A) 5 is the number of beds. It puts only one lamp on each bed, not one at every corner.
- (B) 18 is 3+4+5+6. It forgets the heptagon, which has 7 corners.
- (C) 30 is 4+5+6+7+8. It starts from the quadrilateral and goes up to an octagon, giving every bed one corner too many.