This is a very basic question on $s$-$t$-connectivity in directed graphs. As a baseline, using DFS (or BFS), one can solve the problem on a graph $G=(V,E)$ in $O(n+m)$ time and $O(n)$ space, where $n=|V|$ and $m=|E|$.
However, I have seen mentioned in several places that DFS/BFS let you solve the problem in $O(n)$ time and space. For instance:
Two basic results on the complexity of $\mathsf{STCONN}$ exist for over 20 years. The first follows from the discovery of the very efficient algorithms for graph traversal, BFS (Breadth-First Search) and DFS (Depth-First Search), which use only linear time and space in $n$, the number of vertices.
Theorem 4. $\mathsf{STCONN}\in\mathrm{TISP}(n,n)$.
from [1]. How does that work? (Sorry if this question is trivial...) I would have thought maybe this followed from taking $n$ as the input size (not the number of vertices), but the text before does contradict this interpretation.
[1] Avi Wigderson. The Complexity of Graph Connectivity. MFCS 1992: 112-132