My AC Python few clear case descriptions of the problem though


  • 0
    class Solution(object):
        def read(self, buf, n):
            cnt, buffer = 0, [''] * 4
            while cnt < n:
                rcnt = read4(buffer)
                if not rcnt:
                    return cnt
                buf[cnt: cnt + rcnt], cnt = buffer[:rcnt], cnt + rcnt
            if cnt > n:
                buf = buf[:n]
            return n
    

Log in to reply
 

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