Degree of Polynomial | Problem - 52 | Beginner level | C language | CodeChef

Link to the problem statement: https://www.codechef.com/submit/DPOLY

Solution: 

#include <stdio.h>

int main(void) {
int t;
scanf("%d", &t);
while(t--)
{
    int i, n, d;
    scanf("%d",  &n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d", &a[i]);
        if(a[i] != 0)
        {
            d = i;
        }
        
    }
    printf("%d\n", d);
}
return 0;
}

Hope this will help you, if you want anything else leave a comment.

Thank you 

Comments

Popular posts from this blog

My very 1st contest! | Problem - 1 | Beginner level | C language | CodeChef

Implementing linked list in C language

Score High | Problem - 4 | Beginner level | C language | CodeChef