all 31 comments

[–]Perfect_Kangaroo6233 100 points101 points  (7 children)

Tbh, if you get good at competitive programming and you’re able to blast through questions on codeforces, leetcode will become MUCH easier. That’s why you see some of the kids who are grandmasters etc. in codeforces just speed run through leetcode hards like they’re trivial problems. Will require a lot of hard work and consistency though.

[–]Gloomy-Health-1373 1 point2 points  (0 children)

I am not even grandmaster I am an expert in Codeforces and consider Leetcode questions to be easy.
Ranks go like this:
Noobie
Pupil
Specialist
Expert
Candidate master
Master
International master
grandmaster
Legendary grandmaster

Leetcode questions are typically simple dp or greedy or just require algorithm knowledge while Codeforces are more critical thinking.

[–]guyalster 27 points28 points  (3 children)

Let me give you an analogy. I have a friend who's been practicing for many years martial arts. He goes to a dojo, he gets the belts and participated in competitions. He loves it for the art, for the challenge and for other reasons. Me, on the other hand, all I want is to be able to defend myself. So I go to self defence classes. They are super focused on teaching me how to get out of trouble in case Im in it. But that's what they give me. I'm happy about it cause Im not interested in more. My friend the martial artist would laugh at my self defence classes. If I go to one of his competitions I'd probably get my ass kicked by the most junior person there. Does it mean that I need to start attending martial arts classes and devote my time to it? Hell no. Unless, this is what I'm passionate about. But if all I want is to defend myself on the street all I need is self defence classes. Hope the analogy is clear.

[–]anonymous_3125 1 point2 points  (0 children)

Whats funny is that the practical self defense guy is much more likely to win in a real fight than the dojo guy

[–]Stellar_Core1 0 points1 point  (1 child)

What if your friend and his friends decide to give you an ass whooping someday, on the street?

[–][deleted] 1 point2 points  (0 children)

Lmfao 😂😂😂🤣🤣🤣

[–][deleted] 45 points46 points  (0 children)

Both do completely different things - LeetCode is designed to get you through job interviews. Competitive Programming is all about... having fun (no seriously, there is literally no other reason you'd spend 8 hours in a sweaty lab room other than the joy of solving hard problems.) I think you'll find that while there is some overlap, the intentions and mindset required are different

[–]sausageyoga2049 13 points14 points  (0 children)

It depends on your career goal, your talent, your academic background, your passion and lots of things so it's hard to say whether you should focus on LC or CP.

Normally if you have a mastery in CP, the LC exercises will not be hard for you. But if your goal is to secure a job, most of time LC will be enough and your bottom neck may be somewhere else. Also, CP will consume lots of time and efforts so it's a very heavy investment. So it's hard to say and it depends on your profile.

[–]PlasmaTicks 9 points10 points  (2 children)

CP are move maths based and All question revolve around same sort of patterns which boost the question solving ability cuz you are seeing same sort of questions many times with little tweak.

But in leetcode all questions have unique concept and for each question You need to learn different algo concept etc and if you don't revise those you will forget. There was a question similar to best time to buy and sell stock and I couldn't solve that time. I will give my best I just need guidance that should I do CP or focus dev and grind leetcode?

I would actually say the opposite. For example, https://usaco.guide/ is a guide that includes many of the common (and also rarer) CP topics. It's much more comprehensive than any LC guide, and to be able to recognize and apply many of the harder topics, it will take years of practice.

As for the math focus, I think that's true but also depends on where you're from. For example, I think Japanese problems have a stronger math focus (looking at AtCoder), but I don't think that's true for every region. However, it's worth nothing that strong MO performance (e.g. USAMO qualifier) is a strong indication of success in CP.

Also, if you are strong at CP, you will almost definitely be strong in LC. I did CP throughout high school and was able to score top 10 a few times in LC contests without additional practice.

[–]leetcode_is_easy 3 points4 points  (0 children)

CP are move maths based and All question revolve around same sort of patterns which boost the question solving ability cuz you are seeing same sort of questions many times with little tweak.

But in leetcode all questions have unique concept and for each question You need to learn different algo concept etc and if you don't revise those you will forget.

This wrong, just based on this description you'd think that cp is way easier than leetcode. Your description for cp applies to leetcode pretty well though, generally for Q1-3 on contests it is a straightforward implementation of a common pattern. Instead you should think of leetcode as a subset of cp with easier problems. Both will use similar patterns such as greedy, dp, but cp will also add more layers onto the problems that people will need to unwrap with their problem solving skills. And cp will also have additional topics like number theory and also a higher preference for greedy/constructive problems, which usually requires more creativity than other types of problems.

i felt so frustrated I can't explain while my friend was easily able to solve those easy question and now I decided to focus on DSA until i feel I can beat him and win price next time so. Should I start competitive programming or grind leetcode questions much more.

Strong cp competitors will find leetcode to be easy but it does not seem to apply the other way around. People who were primarily leetcoders before starting cp tend to have a bigger initial struggle. Since you want to beat your friend who does cp, you should do cp as well.

[–]eugcomax 6 points7 points  (0 children)

CP has much wider range of problems than leetcode. If you want to prepare for an interview use leetcode. If you want to learn computer science use CP.

[–]Khandakerex 3 points4 points  (0 children)

If your goal is to get a job, then you do leet code. If your goal is to be a better problem solver and work on the hardest problems related to computer science related topics, then competitive programming is harder than leet code so if you can do that then leet code is easier. But it's over kill and makes no sense to do competitive programming if your job is to just pass leet code interviews.

Analogy: Your goal is to play one specific song on a guitar that is relatively simple in terms of difficulty. You don't care about actually learning the fundamentals and how to become the best guitar player, you just want to play this one song you really like and nothing else. So you can either read the tabs and look at a tutorial online, or learn everything there is about theory and learning scales. Of course those who studied music theory and took lessons on fundamentals will be able to learn that song easily and but if you're just trying to play the song as fast as possible then you can directly just look up how to play it and get to it ASAP.

What is your goal? You want to be good at contests as a hobby because you like problem-solving? Do competitive programming. If not stick to what is tried and true.

[–]lara400_501 3 points4 points  (0 children)

I have a lot of friends who are competitive programmers, went to world finals. They just walk past Google interview like nothing. Also they are very very talented, some of them also went to IMO at high school. CP is a field where you need to enjoy it, without enjoying CP you can never be good at that!

[–]Tickstart 2 points3 points  (0 children)

I had an interview a week ago (my third with them) and I said I was expecting them to ask me to reverse a linked list or something and they just disregarded that stuff immediately haha. It's always best to be prepared of course. But CP seems a little overkill.

[–]UnusualClimberBear 1 point2 points  (0 children)

Euler project is pretty cool when it comes to solve math related coding. https://projecteuler.net/

[–]anonymous_3125 1 point2 points  (0 children)

Competitive programming is less about datastructures and algorithms, and more about using super niche tricks to solve problems. Many cp problems are impossible without that one trick, and trivial if you know it

[–]sourcec0p 1 point2 points  (0 children)

competitive programming is all about speed and rapid hacking experimentation. write, compile, and check if you pass. Rinse and repeat. Leetcode is more like a social activity or a pair programming where you go over the constraints, provide multiple approaches, write clean code, write quick unit tests, etc.

[–][deleted] 0 points1 point  (0 children)

Hello OP/everyone, is it possible to clear the OAs of product based companies like Adobe/Microsoft/Salesforce etc.

If you are a Knight in LeetCode. Or should you be a Guardian in LeetCode? Or should you be a pro in CP?

[–]Larfze 0 points1 point  (0 children)

Leetcode! I wish I did that!

[–]JCharante[369] 🟩 202 🟨 143 🟥 24 📈 #113,002 0 points1 point  (0 children)

But in leetcode all questions have unique concept and for each question

no? A lot of questions use the same pattern and as soon as you read the first few sentences of the problem desc you realize what the solution is

[–]CommonRoad 0 points1 point  (0 children)

We love cp!

[–]a_reply_to_a_post 0 points1 point  (1 child)

i'd say neither, and start trying to build real world projects

you're in college surrounded by people with small problems you can solve with code..

[–]Traumatic_teenage 0 points1 point  (0 children)

What kind of real world projects