Very Short 5-Lines Java Code


  • 1
    O
    public int read(char[] buf, int n) {
        char[] b = new char[4];
        int j = 0;
        for (int k = read4(b); k != 0; k = read4(b))
            for (int i = 0; i < k && j < n; buf[j++] = b[i++]);
        return j;
    }

Log in to reply
 

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