Discussion of Question with ID = 007 under Passwords-and-Inputs

This is the discussion forum for this question. If you find any mistakes in the solution, or if you have a better solution, then this is the right place to discuss. A healthy discussion helps all of us, so you are requested to be polite and soft, even if you disagree with the views of others. The question and its current solution has also been given on this page.

Advertisement

Question

"95 62 98 36 70 09 29 61" is re-arranged according to a particular rule, in the steps mentioned below.

  1. 70 62 98 36 95 09 29 61
  2. 70 61 98 36 95 09 29 62
  3. 70 61 62 36 95 09 29 98
  4. 70 61 62 36 09 95 29 98
  5. 70 61 62 36 09 29 95 98

If step 3 of an input is: 22 24 25 35 93 59 26 80, then what is step 5, if re-arrangement is done according to the above rule?

A

22 24 25 35 26 80 93 59

B

22 24 25 35 26 59 93 80

C

22 24 25 59 93 35 26 80

D

22 24 80 59 93 35 26 25

Soln.
Ans: a

In each step, the numbers whose sum of digits is smallest are being moved to the left. If the sum is equal, then the number on the left is given preference. These are the steps for re-arrangement starting with 22 24 25 35 93 59 26 80:

  • 22 24 25 35 93 59 26 80
  • 22 24 25 35 26 59 93 80
  • 22 24 25 35 26 80 93 59

Comments and Discussion