Crowdsourcing market systems (CMS) are platforms that enable one to publish tasks that others are intended to accomplished. Usually, these are systems where users, called workers, perform tasks using desktop computers. Recently, some CMS have appeared with spatiotemporal tasks that requires a worker to be at a given location within a given time window to be accomplished. In this paper, we introduce the trajectory recommendation problem (or TRP) where a CMS tries to find and recommend a trajectory for a mobile worker that allows him to accomplish tasks he has some affinity with without compromising his arrival in time at destination. We show that TRP is NP-hard and then propose an exact algorithm for solving it. Our experimentation proved that using our algorithm for recommending trajectories is a feasible solution when up to a few hundred tasks must be analyzed to find an optimal solution.