• + 4 comments

    My code is

    def pairs(a,k):
        # a is the list of numbers and k is the difference value
        c=0
        for i in a:
            g=i+k
            if g in a:
                c+=1;
           
        return  c
    

    Why am i getting timeout in some of the test cases?