There are a lot of tricks.
Ask to see the work in progress before you give a hint.
Learn to give minimal hints, not answers. One sort of hint is pointing to where the answer might be found.
More extreme is to ration your hints to each person. Even more extreme is to charge "points" for hints, though it is better if they have some mechanism to earn them back.
If there is only one (or two) students who do this, perhaps an office session would be appropriate to explore why they do this. Some students come with misinformation about the material or how they should deal with it. Some of these are deep seated and very hard to solve, but some can be handled by just giving a flash of insight. The hard cases may require extra tutorials to catch up.
In CS programming lab situations, the best mechanism is Pair Programming where students work in pairs on their lab exercises. It might be applicable to some other fields. This is especially useful if you have more than a few students who exhibit this sort of behavior.
Also ask yourself if there is something about the overall class structure that is lacking and see if you can't address that. Longer lectures probably isn't the right answer for that one though IMO. More sample problems might be.