Priyanka and Toys

  • + 0 comments

    python3

    def toys(w):
        # Write your code here
        
        count = 1
        w = sorted(w)
        curr = w[0]
        for i in w:
            if abs(i - curr) > 4:
                count += 1
                curr = i
        
        return count