Anyone else think the prompt for this challenge is contradictory?
The rules for comparing packets include
- If both values are lists, compare the first value of each list, then the second value, and so on. If the left list runs out of items first, the inputs are in the right order. If the right list runs out of items first, the inputs are not in the right order. If the lists are the same length and no comparison makes a decision about the order, continue checking the next part of the input.
- If exactly one value is an integer, convert the integer to a list which contains that integer as its only value, then retry the comparison. For example, if comparing
[0,0,0]
and2
, convert the right value to[2]
(a list containing2
); the result is then found by instead comparing[0,0,0]
and[2]
.
But if you compare lists according to the rules, [0,0,0]
vs [2]
should be incorrect order since the right side runs out of items first. But the sample data evaluation we’re told
Compare [2,3,4] vs 4
- Mixed types; convert right to [4] and retry comparison
- Compare [2,3,4] vs [4]
- Compare 2 vs 4
- Left side is smaller, so inputs are in the right order
So the rule for “list vs wrapped integer” is not the same as the rule for “list vs list”. Am I crazy?