How to optimize this python solution?


  • 0
    S
        def isReflected(self, points):
            """
            :type points: List[List[int]]
            :rtype: bool
            """
            if len(points) == 0:
                return (True)
            hold = []
            for p in points:
                hold.append(p[0]) 
            x = float(max(hold)+min(hold))/2
            for p in points:
                yrp = p[1]
                xrp = x - (p[0] - x)
                if [xrp, yrp] not in points:
                    return (False)
            return (True)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.