r/leetcode • u/Pixel3818 • Oct 13 '23
Why do Leetcode when AI can do it better?
I’ve been recently getting into solving Leetcode problems at a beginner level. I wrote some code which was resulting into memory leakage so just out of curiosity I pasted it into ChatGPT and asked what the problem. Within a second, it found out the mistake and gave me 3 pointers to improve my code!
Why the hell am I stuck trying to train myself into doing these problems like a monkey when AI can presently do it much better in a fraction of a second! My goals of doing 200 problems seem so futile now.
Feeling dejected
57
u/imjustreallystupid Oct 13 '23
AI CANNOT do Leetcode better than humans. Just try any medium-hard problem and you will see. Writing long coherent codes is far beyond the ability of chatbots at the moment. Github copilot might be able to solve some medium/hard questions tho due to people literally putting the solutions to problems on Github
6
15
u/No-FreeLunch Oct 13 '23
I’m not advocating for immediately replacing all SWE with AI, but have you tried GPT4? I’d say it’s pretty damn good at LC medium/hard
19
u/DecisiveVictory Oct 13 '23
A key question is whether it's damn good because it's seen the exact task before, or it's damn good because it has seen similar tasks before (like a human may have).
2
u/No-FreeLunch Oct 13 '23
I think it’s a bit of both, but regardless, that wasn’t the question. I’d put money on GPT4 being better at solving LC problems than any human, even if that is just because it’s seen the problem already.
I personally use it for help when I get stuck, especially when the posted solutions use a different approach from mine or are poorly explained.
3
u/Tevedeh Oct 13 '23
It’s really not a “bit of both”. GPT4 does not know how to solve LeetCode contest problems. Saying it’s better than any human is insanity.
2
u/run2sky Oct 13 '23
Poorly and not clear problem statements are the spots where the human mind is the only solution. And just because of these vague scenarios you would need to train your brain to find a solution.
1
u/parag778 Jul 14 '25
you haven't seen those "any human" you are talking about. watch tourist streams, your jaw will drop to the core of the earth.
2
1
u/GauravPumpkinEater69 Aug 30 '25
AI will do problems that it has seen before and has solution, finding proper data I feel this is not an intelligence in terms of coding, but in terms of processing of videos and images next level stuff.
2
u/WrastleGuy Aug 03 '24
10 months later and it’s much better.
1
u/reddit-abcde Aug 14 '24
and more AI SWEs like Devin will be produced
2
3
u/gotmilksnow Oct 13 '23
Yup - this. Ive tried to get ChatGPT to find bugs in my code for few trickier mediums and hard problems, and it utterly failed. Found the problems myself and they weren’t anything major. This is with GPT 4 btw.
1
u/BraveTomatillo7551 Oct 14 '23
Yeah sometimes it pushes you in the wrong direction just wasting your time. Sometimes it's helpful, it's pure statistics and not much certainty
1
1
-6
7
7
u/Big-Fold9482 Oct 13 '23
The point of Leetcode is to make sure then when you do need to code and when the AI doesn't work that you can figure it out.
The solutions to basically all Leetcode problems were already a google search away even before ChatGPT. Just because the AI knows the solutions (many of which are probably solutions that it has memorized) doesn't mean anything for you.
They will keep Leetcode in interviews so long as you have to debug AI solution given even 15 percent of time. Once the AI is never making a mistake (don't know how long that will take or if it will happen) is when the software engineering role will change significantly.
7
2
u/DecisiveVictory Oct 13 '23
So why exactly did you decide to solve 200 Leetcode problems?
-1
2
Oct 13 '23
Those are easy problems that have been solved and discussed all over the internet.
it's not that great at critical thinking/innovative thinking. Just try pasting in one of the newer medium/hard problems they write each week for contests. It might get 2/4 of problems on a good day.
2
u/achilliesFriend Oct 13 '23
Why do you write exams when you can just copy from text books.
Why do i interview you when i can hire 100 other people who can do same thing.
2
2
Oct 13 '23
Try giving it a new codeforces question that it hasn't seen before, it will choke and go cry to it's mother, like most people do when they are asked to grind leetcode for a job.
1
1
u/reddit-abcde Aug 14 '24
Smarter AI SWEs like Devin will be produced
so it is better to change field
1
u/Ill-Let-3771 May 27 '25
AI cannot currently do Leetcode without being programmed to integrate specific functions, in a specific way. AI is essentially told how to solve each Leetcode problem - and that is not problem solving in the same way a human can use empirical footwork to ask questions, resolve nuisance details, test new possibilities, build new perspectives, and extract a solution with reasoning.
1
u/Drackend Oct 13 '23
Many leetcode questions are popularly discussed across the internet (which ChatGPT was trained on), so it only makes sense that it can solve them. However, many of the newly added questions even GTP-4 struggles on. There are also quite a few hards it can't reliably do.
The bigger problem through is that when you tell something's wrong, it can't reliably fix its mistakes. It thinks there are problems where there aren't and vice versa. We need programmers to do actual thinking still
To your question, leetcode is a test of your skill, nothing more. It's about what you know, not what anyone else (ai or other people) know. Even if ai can do it, you still need to know it so you can fix it when ai can't
1
u/TekintetesUr Oct 13 '23
Why the hell am I stuck trying to train myself into doing these problems like a monkey when AI can presently do it much better in a fraction of a second!
Mostly because Leetcode has little to nothing to do with real-life software engineering problems that you'd face day to day.
1
u/PuzzleGas Oct 13 '23
AI is likely not gonna solve your Leetcode type problem efficiently in practice (at work). Not at all.
Solve them yourself and forget this question.
1
u/AdministrativeTell45 Oct 14 '23
GPT will eventually solve all tough code forces problems without a doubt. It might take decades but will happen. Yet there be value to practice. Did we stop to run when we got vehicles?
1
u/reddit-abcde Aug 14 '24
the value is tiny
using your analogy, we reduced the need to run / ride a horse to get to our destination after we got vehicles
1
0
Oct 13 '23
[deleted]
-11
u/Pixel3818 Oct 13 '23
This feels so pointless. I’m busting my ass when it absolutely doesn’t matter
6
Oct 13 '23
Just because a calculator can do arithmetic doesn't mean it's useless to understand how to do arithmetic. This logic is very weak.
3
u/MeMyself_N_I1 Oct 13 '23
Unfortunately, that's the same with many tests.
SAT/ACT are also completely pointless in real life (albeit, they are targeted to measure preparedness and amount of money you spent on tutors, not intelligence).
In some countries, instead of LC they give you sample tasks (such as: you have three days to design a text-to-speech converter with any frameworks you want. It must have an API and a convenient UI). This type of test, however, is more prone to cheating.
I've seen some internships experiment with blending in some closer to life tasks, such as simple SQL or CSS tasks. I am relatively good at OAs, but these feel like they should better estimate your abilities.
9
32
u/leetcode_is_easy Oct 13 '23
ChatGPT was most likely trained with many leetcode problems and solutions in its dataset so it tends to be good at existing leetcode problems as it is just regurgitating from memory, but give it novel problems from codeforces/leetcode contests and it will struggle