## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Degree of Polynomial CodeChef Solution | CodeChef Problem Solution 2022

In mathematics, the degree of polynomials in one variable is the highest power of the variable in the algebraic expression with non-zero coefficient.

Chef has a polynomial in one variable $x$ with $N$ terms. The polynomial looks like ${A}_{0}\cdot {x}^{0}+{A}_{1}\cdot {x}^{1}+\dots +{A}_{N-2}\cdot {x}^{N-2}+{A}_{N-1}\cdot {x}^{N-1}$ where ${A}_{i-1}$ denotes the coefficient of the ${i}^{th}$ term ${x}^{i-1}$ for all $\left(1\le i\le N\right)$.

Find the degree of the polynomial.

Note: It is guaranteed that there exists at least one term with non-zero coefficient.

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.
• First line of each test case contains of a single integer $N$ - the number of terms in the polynomial.

• Second line of each test case contains of $N$ space-separated integers - the ${i}^{th}$ integer ${A}_{i-1}$ corresponds to the coefficient of ${x}^{i-1}$.

### Output Format

For each test case, output in a single line, the degree of the polynomial.

### Constraints

• $1\le T\le 100$
• $1\le N\le 1000$
• $-1000\le {A}_{i}\le 1000$
• ${A}_{i}\ne 0$ for at least one $\left(0\le i.