• + 1 comment

    I've solved the psuedocode , but the thing is I am not able to find the solution if the loop never ends {i.e., -1 . Its a bit tricky}.

    If any one can find the solution please do reply back.

    def iterateIt(a):
        emp = []
        rep = 0
    
        while True:
            b = []
            for x in a:
                for y in a:
                    if x != y:
                        temp = abs(x-y)
                        b.append(temp)
            a = b
            rep = rep + 1
    
            if a == emp:
                return rep