Find the longest side of a triangle when the sides are in a sequence with a common difference as 2 The Question:

Sides of a triangle form an arithmetic sequence with a common difference of 2. The area of triangle is $24 cm^2$. If the length of the greatest side is $P$, find the length of $P$.

My thoughts on this statement arithmetic sequence with a common difference of 2, is that the sides of a triangles differ by $2cm$.
So let the sides of the triangle be $x,x+2,x+4$.
According to heron's formula for finding the area of a triangle:
$A=\sqrt{s(s-a)(s-b)(s-c)}$, where $a,b,c$ are the 3 sides of the triangle and $s$ is the semi perimeter of the triangle: $\frac{a+b+c}{2}=s$
For this: $\frac{a+b+c}{2}=s$, I substituted $x,x+2,x+4$,
So it becomes:
$$\frac{x+(x+2)+(x+4)}{2}=s$$
$$\text{After substitution, this becomes}$$
$$\frac{3x+6}{2}=S$$
Substituting that into heron's formula:
$$24=\sqrt{\frac{3x+6}{2}(\frac{3x+6}{2}-x)(\frac{3x+6}{2}-(x+2))(\frac{3x+6}{2}-(x+4))}$$
$$24=\sqrt{\frac{3x+6}{2}(\frac{3x+6}{2}-\frac{2x}{2})(\frac{3x+6}{2}-\frac{2x+4}{2})(\frac{3x+6}{2}-\frac{2x+8}{2})}$$
$$24=\sqrt{\frac{3x+6}{2}(\frac{x+6}{2})(\frac{x+2}{2})(\frac{x-2}{2})}$$
The positive root of the expression is $6$
So, the longest side I got is $$x+4=10$$
So, is my answer and logic correct?

Building on Jaap and Math Lover's comments
Your solution is perfectly correct but it is advisable not to try this in olympiads as you have limited time over here and you can't devote this much time to one comment otherwise you won't be able to do the other questions. Instead let $x-2,x,x+2$ be the sides of the triangle and then solve it and yay you got a expression much easier to solve. Just solve that qurtic equation and get the answer. You will get $x$ as $8$.
