LearnFrenzy
Sign in Take a free test

Input-Output · Discussion forum

Hard Level Question 3 – answer, explanation & discussion

  • 0 comments
  • Answer explained
  • Moderated community
Question 3 Back to Exercise

A word and number arrangement machine rearranges an input line step by step, following a rule. Here is an illustration of the input and the steps:

Input: desk 79 56 queen oak 45 fish 68
Step I: 79 56 queen oak 45 fish 68 desk
Step II: 79 56 queen oak 45 68 fish desk
Step III: 79 56 queen 45 68 oak fish desk
Step IV: 79 56 45 68 queen oak fish desk

Following the same rule, the machine is given this input: hill 63 72 76 lamp pot pen 37

Which step is the last step for this input?

  • A Step II
  • B Step V
  • C Step IV Correct
  • D Step III
Correct Answer: Option C

Rule (from the illustration): In each step the word that comes first in the dictionary, of those not yet arranged, moves to the right end, before the words already arranged; numbers keep their order.

For the new input: Step I: 63 72 76 lamp pot pen 37 hill; Step II: 63 72 76 pot pen 37 lamp hill; Step III: 63 72 76 pot 37 pen lamp hill; Step IV: 63 72 76 37 pot pen lamp hill.

Answer: Step IV

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links