Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. The elements it has not yet touched always stand together at the left of the line, in their original order. In each step the machine takes one untouched element and places it at the extreme right end of the line: in odd-numbered steps it takes the leftmost untouched element, and in even-numbered steps it takes the rightmost untouched element. The machine stops once no untouched element is left.
Input: 26 lotus 58 mint 41 nectar.
At which step of the above arrangement does the line "58 mint 26 nectar lotus 41" appear?

Competition practiceInput-Output
  • AStep 3
  • BStep 5
  • CStep 2
  • DStep 4

Step-by-Step Solution

Step 1: lotus 58 mint 41 nectar 26. Step 2: lotus 58 mint 41 26 nectar. Step 3: 58 mint 41 26 nectar lotus. Step 4: 58 mint 26 nectar lotus 41 — the line asked about. Step 5 would be mint 26 nectar lotus 41 58 and Step 6, the last, 26 nectar lotus 41 58 mint. The count of untouched elements settles it: only 58 and mint are still waiting at the head, so four elements have already been taken, which means four steps have been made.
Answer: D) Step 4

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…