One approach to both problems is to start by looking at them modulo various divisors of the original modulus, with each subsequent divisor being multiple of the preceding one. Each step then provides further refinement of the information we have about the solutions; reducing the amount of work we need to perform.
For example, in the first case, we can proceed as follows:
- Let's start by looking at the equation "modulo $3$". Trying out all three possible remainders of $x$ modulo $3$ tells us that only $x\equiv 1\pmod 3$ works.
- This implies that once we move to "modulo $6$", the only possible values of $x\pmod 6$ will be $1$ and $4$. As it turns out, both of them work modulo $6$.
- Finally, let's get up to "modulo $12$". Since we had two possible remainders modulo $6$, there are four candidates modulo $12$: $1, 4, 7, 10$. Of these, only $7$ and $10$ turn out to work; both being solutions of the original equation.
Of course, one doesn't need to restrict to primes; we could just as well start by looking at the equation modulo $4$ and check the four possibilities in order to find that $1$ and $2$ work; and then step up directly to "modulo $12$".
Alternatively, if one is more interested in the theory behind the problems, the first one is good example for the Chinese Remainder Theorem and the second one goes well with Hensel's Lifting Lemma.