Practice30Create account

A number-arranging machine rearranges an input line of numbers step by step. Example — Input: 62 34 89 17 45 23; Step 1: 17 62 34 89 45 23; Step 2: 17 23 62 34 89 45; Step 3: 17 23 34 62 89 45; Step 4: 17 23 34 45 62 89 (last step). In each step the next-smallest number is moved to the leftmost not-yet-fixed position, the others keeping their order. How many steps are needed to complete the arrangement for the input '55 28 71 39 84 16'?

Competition practiceInput-Output
  • AThree
  • BFive
  • CFour
  • DTwo

Step-by-Step Solution

Step 1: 16 55 28 71 39 84; Step 2: 16 28 55 71 39 84; Step 3: 16 28 39 55 71 84. After placing 16, 28, 39 the rest (55 71 84) is already in order, so 3 steps complete it.
Answer: A) Three

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 number-arranging machine rearranges an input line of numbers step by step. Example —…A number-arrangement machine, given an input row of numbers, rearranges it in steps. In…A number-arrangement machine, given an input row of numbers, rearranges it in steps. In…A word-arrangement machine, given an input row of words, rearranges it in steps. In each…A word-arrangement machine, given an input row of words, rearranges it in steps. In each…