Example 1 · level 1
A machine rearranges a line of words, one word per step, using the same rule every time. In each step, the word that comes last in dictionary order not yet arranged moves to the left end, next to the words already arranged there. If the next word is already in its place, it is skipped without using a step. Input: jasmine falooda henna mango pepper kite Step 1: pepper jasmine falooda henna mango kite Step 2: pepper mango jasmine falooda henna kite What is Step 4?
- pepper kite mango jasmine henna falooda
- mango pepper kite jasmine henna falooda
- pepper mango kite jasmine henna falooda
- pepper mango kite jasmine falooda henna
Show solution
- Rule: In each step, the word that comes last in dictionary order not yet arranged moves to the left end, next to the words already arranged there.
- Step 1: pepper jasmine falooda henna mango kite
- Step 2: pepper mango jasmine falooda henna kite
- Step 3: pepper mango kite jasmine falooda henna
- Step 4: pepper mango kite jasmine henna falooda
- What is Step 4? → pepper mango kite jasmine henna falooda.
Answer: pepper mango kite jasmine henna falooda