Source: Distress Signal
Part 1
Given pairs of
Signal
s (where aSignal
is a nested list ;example:[[1],[2,3,4]]
), count how many pairs are ‘in order’.
One Signal
is less than the other if:
- Both are an integer and the first is less than the second
- Both are a list and the first value is less than the second
- If the first values are the same, compare the second
- If the first has fewer elements, it is treated as less than the second
- When comparing an integer and a list, wrap the integer as a single element list and compare them