Solution :

At a time $$t$$ when velocity vector become mutually perpendicular
$$\eqalign{
& v\cos {45^ \circ } = 5\,{\text{horizontal component}} \cr
& v = \frac{5}{{\cos {{45}^ \circ }}} = 5\sqrt 2 \,m/s \cr} $$
Vertically,
$$\eqalign{
& v\sin {45^ \circ } = gt \cr
& \Rightarrow t = \frac{{v\sin {{45}^ \circ }}}{g} = \frac{{5\sqrt 2 \times \frac{1}{{\sqrt 2 }}}}{{10}} = \frac{1}{2} \cr
& {\text{so,}}\,\,OA = OB = v\cos {45^ \circ } \times t = 5 \times \frac{1}{2} = 2.5 \cr
& \Rightarrow AB = 2.5 \times 2 = 5\,m \cr} $$