Three.
Texas Instruments technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Three. Boxes with stones and pebbles
Four boxes have been numbered 1,2,3,4,5,6,7,8, respectively. Each box is to be filled up either with a stone or a pebble so that at least one box contains a pebble, and the boxes containing pebbles are consecutively numbered.
What is the total number of ways in which you can do this?
Show answer & explanation
The set of boxes containing pebbles must form a non-empty contiguous block [i, j] from 1 to 8. The number of such subsegments is 8 * 9 / 2 = 36.
Step-by-step Derivation:
Step 1: Pebbles must occupy consecutively numbered boxes, corresponding to a contiguous range [i, j] where 1 <= i <= j <= 8.
Step 2: Range length 1: 8 choices. Range length 2: 7 choices ... Range length 8: 1 choice.
Step 3: Total ways = 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 = 8 * 9 / 2 = 36.