Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
By the way, maybe the following strategy may be of use: since you can assume that all elements of the initial matrix are 0 or 1, you can brute-force this $m(n)$ on a computer at least for n=1,2,3,4,5 (maybe 6 too - there are $2^{n^2}$ matrices). And then look up that sequence on oeis.org
I mean, let us suppose that your vertices are rather labeled $\{0,\ldots,n-1\}$, and you start in $0$. Now, instead of considering the random walk with reflection in $0$ (and waiting until it comes to $n-1$), you may as well consider the simple random walk on $\{-(n-1),\ldots,n-1\}$ (in fact, the reflected random walk is just its absolute value). So, the hitting time of $n-1$ for the reflected random walk is the same as the hitting time of $\{-(n-1),n-1\}$ for the "normal" random walk on $\{-(n-1),\ldots,n-1\}$.