Some time ago I had a linear algebra private lesson, and rereading some notes of the professor, I've found
If two real matrices $A,B$ have the same characteristic polynomial and rank, and satisfy $ \operatorname{rk}(A-\lambda I)= \operatorname{rk}(B-\lambda I)$ for each eigenvalue, then they are similar
but with no proof. Is this true? And if so, how would one prove it? What I do know is that having the same characteristic polynomial and rank is not enough, but I'm not sure why the additional condition would fill the gap
How about $$\pmatrix{0&1&0&0\\0&0&0&0\\0&0&0&1\\0&0&0&0}$$ and $$\pmatrix{0&1&0&0\\0&0&1&0\\0&0&0&0\\0&0&0&0}?$$