0 ms solution. Something wrong?


  • 0
    A

    The code is straightforward, but I got zero ms finished? what is going on? Anybody observed the same issue?

    // Forward declaration of the read4 API.
    int read4(char *buf);
    
    class Solution {
    public:
    /**
     * @param buf Destination buffer
     * @param n   Maximum number of characters to read
     * @return    The number of characters read
     */
    int read(char *buf, int n) {
        int i=0, c, j;
        char temp[4];
        do{
            c=read4(temp);
            j=0;
            while (j<c && i<n){
                buf[i++]=temp[j++];
            }
        } while (i<=n && c==4);
        return i;
    }
    };

Log in to reply
 

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