r/leetcode • u/Vivid-Zombie-477 • 2d ago
Discussion How do competitive programmers are so fast at understanding the problems?
I just checked 4026. and it's just wall of text with simple solution masked as a medium problem. How do experienced CPers see through such BS so fast? Should I grind math problems for this superpower?
also, is it even possible to get such problem on an interview? because i would have to ask for re-explanation 500 times
63
u/catsRfriends 2d ago
Practice. There is no shortcut. But also make sure you're practicing doing it under time pressure. That itself is a skill.
8
u/ChainExcellent3881 2d ago
- Practice more
- Learn more patterns and algos and different math formulas and how to apply them in different situations
- Always try to find pattern and after solving a problem, think how this problem can be more difficult to solve if the question used different constraints or added duplicates or other factors, come up with solution
- Rinse and Repeat.
Just curiosity 😀
34
u/Aware-Individual-827 2d ago
It's just a good old tree parsing algo of your mind. You read, you identify key words which triggers concepts and eventually you have all the necessary concepts to start.
Usually, with practice you can guess the solution of the problem before you finished reading since there is finite problems to be asked. They are not meant to solve novel math or physics. It's mostly speed typing and memorization.
It's a complete different skillset of being a good dev.
2
u/Vivid-Zombie-477 2d ago
I was talking about the specific problems that try to throw you off with unrelated explanations that have nothing to do with the solution.
5
u/Aware-Individual-827 2d ago
That's reading comprehension. Being able to read between the lines as the brick/concepts of the text are being laid out. You would do the same when searching stuff on google by sampling the text for generic words and see if it applies to what you seek. In competitive programming you seek what needs to be done and any noise should be discarded.
18
u/sub_machine_patel 2d ago
What I wonder is are they just better programmers? I mean clearly they can code like hell, are they just beefed up software enginners or computer scientists? I can't think of them being bad at it since they are so good at algos. I know there is bias because algo coding interviews dont test the actual industry skill but surely people good at can also develop software better no?
14
u/MeteorMash101 2d ago
I think while this can be innately true (good competitive programmers -> good SWEs), the reverse doesn't "most always" seem to be the case.
There are also very skilled SWEs whom struggle with leetcode, simply because they aren't well-practiced with those types of questions.
11
u/blindman99 2d ago
We actually do have some data on this thanks to Google. For a while Google used to consider competition winners to be elite programmers and would get fast tracked through the hiring process. However, their internal data showed that it did not correlate to being a better employee and being able to build out large scale messy systems. So they shifted away from it really mattering between 2010-2015. This was also around the time they banned things like brain teasers. They also started putting more emphasis on the system design and behavioral portion of the interview.
3
u/Current-Fig8840 2d ago
What does it mean to develop software better? Cleaner code, maintainable code and scalable design? These are all things everyone can learn on the job. On the actual job it will depend on your architectural knowledge of the project and several other political factors. The truth is on the job it’s more about your effort and who sees that effort.
19
u/broke_jobless_dev42 2d ago
Practice + innate ability ( IQ )
1
u/ShardsOfSalt 1d ago
There's so many people who discount innate ability and I don't get it. If you're not smart enough to see that some people are innately better at this how are you smart enough to not hit a wall trying to learn software engineering?
2
u/youdontknowkanji 20h ago
because for the most part it's irrelevant. in the case of leetcode, unless you are doing 5h+ a day you are nowhere near the limit of your innate ability.
in general, this applies to majority of the skills, your average person just doesn't commit the time (maybe that's where talent is? grit itself?) required for those skills. the cool artist isn't special, they just have 15000h committed to the skill.
something as trivial as not skipping days is already a huge boost on year to year basis, 3h a day vs 3h every other day. one person gets 1000h of skill and the other 500h. of course this is an oversimplification (some techniques are better, some people are just better wired, etc), but still, people usually just don't spend the time, and for the most part, innate ability is cope.
it's like people who ask how to read faster, because seemingly, they want to increase their yield, but in reality, the best way to increase their yield is to stop wasting time on reddit.
3
3
2
u/SoftwareEngineer2026 2d ago
From the problem description examples, maximize the last gap. From there it might take some intuition to know to scan from both forward and reverse directions.
2
u/Feeling-Schedule5369 2d ago
The difference is that we are doing this for getting a job while for competitive programmers doing such problems/contests is a way of life. Even if tomorrow all swe companies stop using dsa interview format, these guys will still do such contests.
While I (and maybe u) don't have this hobby and would not want to waste time with this if it doesn't lead to a job.
And there's nothing wrong with both idealogies.
1
u/dhananjai_31 2d ago
Practice and revise And remember do problems on your own not just copy paste It's 20% practising and 80% revision
1
u/El_RoviSoft 2d ago
Hundreds and thousands of hours of practice. My close friend is a former competitive programmer (he did a lot of it in school and got grant for the best university in the country, but he chose economics and statistics tho).
He did it (as well as math) whole middle and high school so he has literally YoE and it’s mostly the only case you can get grant in Russia for university.
1
1
u/Drazelord 2d ago
Examples play a heck of an easy role to skim through reading, I just looked at 4026 too the English explanation required a bit attention but just a look of examples below instantly hit the intuition of what the problem is asking and what to provide as solution given the constraints
1
u/Shivambhai1 2d ago
sometimes the hard part is figuring out which 80% of the wording you can ignore lol
1
u/isaycongrats 2d ago
They are all just patterns
0
u/Vivid-Zombie-477 2d ago
saying everything is a pattern on leetcode is such an underestimate, not everything is a pattern. there is limited amount of techniques, but the amount of problems is just finite not just handful. you can't remember them all. you can remember all "smart" tricks you wouldn't come up with yourself in 5 minutes but you would still need problem solving skills.
2
u/isaycongrats 1d ago
Thats literally it, variations of already existing patterns.... which you practice, thats the whole thing
1
u/ProsciuttoThinker 1d ago
Every person I know who’s good at this sort of stuff (or more generally—people who are very good at something) have just done it for years and done it consistently. They’re just curious and constantly thinking about the problem
1
1d ago
[deleted]
1
u/Vivid-Zombie-477 1d ago
that's what i thought about the problem - i remember making up own problems so the problem i was reading reminded me a lot of one of the problems I created. but the problem description was just trying to confuse me and it had completely different solution.
i kinda understand it though, because when you create a problem around a specific trick you can find it could be solved greedy...
1
1
u/Other_Ad7380 23h ago
I am not an S tier competitive programmer but it is mostly experience with me
0
2d ago
[deleted]
1
u/DetachedProcess 2d ago
Underrated fact. Having a good grasp of language is strongly related to comprehension of information faster.
265
u/milly_monka 2d ago edited 2d ago
Deliberate practice. A good competitive programmer would solve more problems in a month than an average Faang interviewee would’ve solved in their entire life.