If $V$ is your vector space and it has a decomposition $V=V_1+V_2$ with $V_1$ and $V_2$ subspaces such that $V_1\cap V_2=\\{0\\}$, and such that both $V_1$ and $V_2$ are invariant for $A$, then the restrictions of $A$ to each subspace define operators $A_1:V_1\to V_1$, $A_2:V_2\to V_2$.
If the dimension of $V$ is $n$ you have $(A-\lambda I)^n=0$ but $(A-\lambda I)^{n-1}\
eq 0$. The first equation implies $(A_j-\lambda I)^n=0$ for $j=1,2$, which in turn implies that $(A_j-\lambda I)^{\dim(V_j)}=0$ for $j=1,2$. This in turn implies that $(A-\lambda I)^{\max\\{\dim(V_1),\dim(V_2)\\}}=0$. Because $(A-\lambda I)^{n-1}\
eq 0$, this implies that $V_1=V$ and $V_2=\\{0\\}$ or vice versa.