If you get to the wrong answer, have you really sped up? Also: use the right tool for the right job. Using a Large Language Model for algebra is like using a hammer to fit screws.
Also, are you using LLMs to try to learn relativity? That would probably explain a lot of your confusion. The kind of pedantic discrimination between frames' descriptions of a scenario that is vital to understanding this is not part of the way they work. So they are frequently spectacularly wrong - we've seen it several times on here.
Strictly, no, because neither rocket nor stars are frames. If you mean "can I work this problem using the rest frame of the rocket or the rest frame of the stars", then yes, of course.
If you use the stars' rest frame, the distance between them is not length contracted (they are not moving) but the rocket's clocks tick slowly. It therefore takes the rocket ##D/v## to travel the distance ##D## between the stars at its speed ##v##, but due to time dilation its clocks measure ##D/(\gamma v)##.
If you use the rocket's rest frame the distance is length contracted to ##D/\gamma## and it therefore takes ##D/(\gamma v)## for the destination star to reach the rocket. The rocket's clocks tick normally in this frame, so there's no further correction needed.
We have the same answer for the elapsed time on the rocket using two different frames. Note that this is one of a very narrow class of problems that can be solved using only length contraction and time dilation. You will generally need the Lorentz transforms.