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.159 tracks/python/exercises/sublist/example.py
trackler-2.2.1.158 tracks/python/exercises/sublist/example.py
trackler-2.2.1.157 tracks/python/exercises/sublist/example.py
trackler-2.2.1.156 tracks/python/exercises/sublist/example.py
trackler-2.2.1.155 tracks/python/exercises/sublist/example.py
trackler-2.2.1.154 tracks/python/exercises/sublist/example.py
trackler-2.2.1.153 tracks/python/exercises/sublist/example.py
trackler-2.2.1.152 tracks/python/exercises/sublist/example.py
trackler-2.2.1.151 tracks/python/exercises/sublist/example.py
trackler-2.2.1.150 tracks/python/exercises/sublist/example.py
trackler-2.2.1.149 tracks/python/exercises/sublist/example.py
trackler-2.2.1.148 tracks/python/exercises/sublist/example.py
trackler-2.2.1.147 tracks/python/exercises/sublist/example.py
trackler-2.2.1.146 tracks/python/exercises/sublist/example.py
trackler-2.2.1.145 tracks/python/exercises/sublist/example.py
trackler-2.2.1.144 tracks/python/exercises/sublist/example.py
trackler-2.2.1.143 tracks/python/exercises/sublist/example.py
trackler-2.2.1.142 tracks/python/exercises/sublist/example.py
trackler-2.2.1.141 tracks/python/exercises/sublist/example.py
trackler-2.2.1.140 tracks/python/exercises/sublist/example.py