Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
576 B
6
Indexable
Never
def check_one_three_two(numbers):
    if len(numbers) < 3:
        return False
    min_value = numbers[0]
    for j in range(len(numbers)):
        if (numbers[j] < min_value):
            min_value = numbers[j]
        for k in range(j, len(numbers)):
            if numbers[j] > numbers[k] and numbers[k] > min_value:
                return True
    return False

test_cases = [
    ([1,2,3,4], False),
    ([3,1,4,2], True),
    ([-1,3,2,0], True),
]

for parameter, expected in test_cases:
    print(check_one_three_two(parameter))
    print(expected)