A number arrangement machine, when given an input line of numbers, rearranges them step by step following a particular rule. An illustration of an input and its rearrangement is given below.
Input: 20 16 54 23 65 62
Step I: 65 20 16 54 23 62
Step II: 65 62 20 16 54 23
Step III: 65 62 54 20 16 23
Step IV: 65 62 54 23 20 16
Step IV is the last step of this input.
Input: 42 79 22 43 66 78
Following the same rule, which number will be third from the right end in Step II for this input?
Answer & explanation
Correct answer: option 2
The correct answer is Option (2) → 22
Compare each step of the illustration with the one before it. In each step, the largest of the numbers not yet arranged moves to the next place from the left end, and all the other numbers keep their order.
Step I: 65 is the largest of the numbers left, so it moves to the first place from the left
Step II: 62 is the largest of the numbers left, so it moves to the second place from the left
Step III: 54 is the largest of the numbers left, so it moves to the third place from the left
Step IV: 23 is the largest of the numbers left, so it moves to the fourth place from the left
After Step IV the numbers stand from the largest to the smallest, so the arrangement is complete.
Apply the same rule to the input 42 79 22 43 66 78.
Step I: 79 is the largest of the numbers left, so it moves to the first place from the left, giving 79 42 22 43 66 78
Step II: 78 is the largest of the numbers left, so it moves to the second place from the left, giving 79 78 42 22 43 66
Counting from the right end of 79 78 42 22 43 66: 66 (first), 43 (second), 22 (third).
So the number third from the right end is 22.