I did my pre-licence in 20 hours and had to pad out the remaining 5 hours. I wasn't doing it full time. I did it over 6 months and had gaps up to three weeks between lessons.
I feel like the main factor towards getting it done efficiently and in low hours was learning at (1) a small uncontrolled field (2) a school with a very "practical" way of operating (and a good instructor) (3) having messed around in desktop flight sims a lot.
I have to agree with what deja vu says about not packing in your flight training. Obviously in the most extreme sense, going at it over two weeks, full time each day won't work for everyone. But even doing a lesson every day or multiple times a week may start to blur memories. It's good to have a decent amount of time after a lesson, proper downtime, to reflect and go over everything that happened, but then also to not have too much time after this reflection and your next lesson.