re: Daily Challenge #18 - Triple Trouble VIEW POST

FULL DISCUSSION
 

A python solution. Assumes numbers are strings.

def gettriples(n):
    s = set()
    for x in range(len(n)-2):
        if n[x]*3 == n[x:x+3]:
            s.add(n[x]*3)
    return s

def tripledouble(n1, n2):
    s1 = gettriples(n1)
    s2 = gettriples(n2)
    return bool(s1 & s2)
code of conduct - report abuse