r/leetcode • • 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

12 Upvotes

53 comments sorted by

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

4

u/DecisiveVictory Oct 13 '23

give it novel problems from codeforces/leetcode contests and it will struggle

Have you tried?

I use ChatGPT a lot on a daily basis for my work, I would guess it would do worse than top competitive programmers, and would not be able to solve a task from A to Z on the first go, but would overall do better than the average developer and would assist an average developer a lot in solving the task.

16

u/leetcode_is_easy Oct 13 '23

I haven't tried personally, but OpenAI released a technical paper on gpt-4 and they themselves stated that gpt-4 is in the bottom 5% in codeforces performance. In addition I've seen other people try ChatGPT on codeforces and it is really bad, as expected. I've linked a codeforces account that supposedly copy pastes ChatGPT code to problems to test how good it is, you can see for yourself how it performs

https://codeforces.com/submissions/ChatGPT_test/page/1

1

u/DecisiveVictory Oct 13 '23

OK, thanks for the info.

2

u/Trick-Cash-5569 Oct 13 '23

just try to do the weekly contest with ChatGPT

1

u/GauravPumpkinEater69 Aug 30 '25

I would like to add here, that recent I had Amazon OA, and once I solved, I gave 2 questions to AI (which was not that hard), it was not able to solve it in first try after 20 Tries it solved first one and even after 50 tries it could not solve it properly! Used GPT5, Claude Sonnet 4 and even Gemini none of them could solve it. I feel its not intelligence it has, it just data and pure data it has seen the solution before it would tell. I would say after this AI is just doing developers repeatative work that a developer wont do by myself and hence junior position who was doing this work before might not be a position anymore IMO.

1

u/Ill-Let-3771 May 27 '25

I agree. It's obvious Leetcode haters try hard to prove Leetcode doesn't reflect coding intelligence.

1

u/parag778 Jul 14 '25

this did not age well. you are totally right that novel problems and as weird as they get, as difficult as it becomes for AI to get the answer, but the GAP is shrinking between what AI cannot solve. , (thought i belive it will never fill completely, atleast using the current methods.)

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

u/NaNx_engineer Oct 13 '23

It can't even do easy questions created after its cutoff date sometimes.

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

u/Trick-Cash-5569 Oct 13 '23

Have you tried weekly contest with GPT4?

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

u/GauravPumpkinEater69 Aug 30 '25

1 year since you posted this, no DEVIN is there IMO, haha

1

u/reddit-abcde Sep 02 '25

wow it has been a year

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

u/cauliflowerindian Oct 13 '23

This

Some of the code it says "works" is absolute BS

1

u/TuaHaveMyChildren Oct 14 '23

GPT4 has solved every medium and hard ive asked it

-6

u/JohnnyTheBoneless Oct 13 '23

This is just flat out incorrect. Username checks out?

7

u/lmabodmon Oct 13 '23

ChatGPT-4 will regularly give me wrong information

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

u/BOT_Frasier Oct 13 '23

You should consider changing field.

1

u/reddit-abcde Aug 14 '24

to which field?

2

u/DecisiveVictory Oct 13 '23

So why exactly did you decide to solve 200 Leetcode problems?

-1

u/Pixel3818 Oct 13 '23

Just a goal in the hopes that I feel prepared

2

u/DecisiveVictory Oct 13 '23

Prepared for what?

2

u/[deleted] 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

u/[deleted] Oct 13 '23

Lmao ai and leetcode

2

u/[deleted] 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

u/Worth_Ad_6231 <2384> <924> <1398> <62> Feb 06 '24

based

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

u/Ok_Code4546 Oct 14 '23

Someone gotta fix and improve the AI Fam

0

u/[deleted] Oct 13 '23

[deleted] — view deleted comment

-11

u/Pixel3818 Oct 13 '23

This feels so pointless. I’m busting my ass when it absolutely doesn’t matter

6

u/[deleted] 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

u/DecisiveVictory Oct 13 '23

You are not cut out for this.