Correct approach means knowledge and the ability of logical thinking.
Trouble writing the code means practice experience missed.
Give her another chance to ensure that is not random luck. If you get the same result, let's hire her and train her in the actual projects.