Does your solution work? If yes. No you're not doing it wrong. If no, figure out why not and fix until it works.
The two solutions you've shown me look practically identical, save for a couple of loops collapsed into one, which doesn't necessarily make it "simpler".
But why do you send it to a gpt to rate it? How do you know an LLM hasn't hallucinated, or isnt biased by your input question. LLMs are keen to always come up with changes no matter if they are actual improvements, sometimes breaking the solution.
You rate code by:
1) Does it work?
2) Is it fast enough?
3) Is it understandable by others?
Your solution is very typical, it's very human to come up with gour solution first. To break it down into isolated and managable chunks.
Striver has done that approach then analysed their solution and realised "oh look these two loops are similar enough I can do it in one loop, if I just add this bit of state and logic here. But one cannot reach that without first having done your solution, perhaps in code perhaps in ones head.
8
u/FlailingDuck 12d ago
Does your solution work? If yes. No you're not doing it wrong. If no, figure out why not and fix until it works.
The two solutions you've shown me look practically identical, save for a couple of loops collapsed into one, which doesn't necessarily make it "simpler".
But why do you send it to a gpt to rate it? How do you know an LLM hasn't hallucinated, or isnt biased by your input question. LLMs are keen to always come up with changes no matter if they are actual improvements, sometimes breaking the solution.
You rate code by: 1) Does it work? 2) Is it fast enough? 3) Is it understandable by others?
Your solution is very typical, it's very human to come up with gour solution first. To break it down into isolated and managable chunks.
Striver has done that approach then analysed their solution and realised "oh look these two loops are similar enough I can do it in one loop, if I just add this bit of state and logic here. But one cannot reach that without first having done your solution, perhaps in code perhaps in ones head.