Any code is accpeted in Python?


  • 0
    H

    It seems to me that some obviously wrong codes still get accepted. Could someone check the OJ? Thanks a lot.


  • -3
    V
    class MovingAverage(object):
        def __init__(self, size):
            self.size = size
            self.L = []
    
        def next(self, val):
            if len(self.L) < self.size:
                self.L.append(val)
                return float(sum(self.L))/len(self.L)
            else:
                self.L = self.L[1:] + [val]
                return float(sum(self.L))/self.size

  • 0

    Sorry, this issue was just fixed. Could you please try again?


  • 0
    H

    @1337c0d3r. Thank you. It looks good now


Log in to reply
 

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