How to prove that language is decidable? Prove or disprove:
The following language $L$ is decidable:

$\{ \langle M, x\rangle: M \text{ is a Turing machine and } M(x) \text{ halts in less than } |x|^2 \text{ steps} \}$

So for proving I need to construct a TM $U$ if it accepts $L$, so $L$ is decidable, otherwise not.

My steps are:

$U$ = "On input $ \langle M, x\rangle$:


$i:=1$;

$n := |x|^2$
Simulate one step of $M$ on $w$.
If $M$ accepted $w$ then $U$ accepts.

If $M$ rejected $w$ then $U$ rejects.

If $i ≥ n$ then $U$ rejects.
Else $i:=i+1$; goto step 2."


Because $U$ is a decider machine, $L$ is a decidable language. 

Is this solution correct? Or I should do it in another way?
If you want to prove that a language is decidable, it is sufficient to construct a Turing Machine that accepts if the input is in the language. It MUST reject if the input is not in the language. 

Additionally, you are required to argue/prove that the Turing Machine constructed does that. Here's a hint: M must just halt on x, for it to be in L. Consider all possibilities of halting.