Daily Temperatures - weekly contest 61 question doubt

  • 0

    I could not understand the meaning of this comment provided in the question -
    "Return an array of size *returnSize" because when I printed the size of this variable then it showed 0. I used temperaturesSize for the size of output array which prints value of 8 but still it does not work and I don't see any issue with my code. Could anyone please help me out with why my code is giving me empty output array.

    int* dailyTemperatures(int* temperatures, int temperaturesSize, int* returnSize) {
    int *newArray;
    int count=0, found=0;
    //printf("%d\n", temperaturesSize);
    //printf("%d", (*returnSize));

    //returnSize = (int*) malloc(temperaturesSize * sizeof(int));
    for(int i=0;i<temperaturesSize;i++)
        count =0;
        for(int j=i+1;j<temperaturesSize;j++)
            count = count + 1;
            if(temperatures[j] > temperatures[i])
                found = 1;
                newArray[i] = count;
        if(found == 0)
    return newArray;


Log in to reply

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