Sha256: 25c60eff0f3c56d6d9c1b359c046676d29df3e63040e9a9cec2997f490259b8a

Contents?: true

Size: 572 Bytes

Versions: 396

Compression:

Stored size: 572 Bytes

Contents

SUBLIST = 0
SUPERLIST = 1
EQUAL = 2
UNEQUAL = 3


def check_lists(l1, l2):
    if l1 == l2:
        return EQUAL
    if contains(l1, l2):
        return SUPERLIST
    if contains(l2, l1):
        return SUBLIST
    return UNEQUAL


def contains(l1, l2):
    if not l2:
        return True
    if len(l2) > len(l1):
        return False
    for i in range(len(l1) - len(l2) + 1):
        if l1[i] != l2[0]:
            continue
        for j in range(len(l2)):
            if l1[i + j] != l2[j]:
                break
        else:
            return True
    return False

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/python/exercises/sublist/example.py
trackler-2.2.1.179 tracks/python/exercises/sublist/example.py
trackler-2.2.1.178 tracks/python/exercises/sublist/example.py
trackler-2.2.1.177 tracks/python/exercises/sublist/example.py
trackler-2.2.1.176 tracks/python/exercises/sublist/example.py
trackler-2.2.1.175 tracks/python/exercises/sublist/example.py
trackler-2.2.1.174 tracks/python/exercises/sublist/example.py
trackler-2.2.1.173 tracks/python/exercises/sublist/example.py
trackler-2.2.1.172 tracks/python/exercises/sublist/example.py
trackler-2.2.1.171 tracks/python/exercises/sublist/example.py
trackler-2.2.1.170 tracks/python/exercises/sublist/example.py
trackler-2.2.1.169 tracks/python/exercises/sublist/example.py
trackler-2.2.1.167 tracks/python/exercises/sublist/example.py
trackler-2.2.1.166 tracks/python/exercises/sublist/example.py
trackler-2.2.1.165 tracks/python/exercises/sublist/example.py
trackler-2.2.1.164 tracks/python/exercises/sublist/example.py
trackler-2.2.1.163 tracks/python/exercises/sublist/example.py
trackler-2.2.1.162 tracks/python/exercises/sublist/example.py
trackler-2.2.1.161 tracks/python/exercises/sublist/example.py
trackler-2.2.1.160 tracks/python/exercises/sublist/example.py