Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: I'm good at coding but bad at competitive coding
36 points by gsaga on Oct 27, 2018 | hide | past | favorite | 45 comments
I'm a computer science student and I consider myself good at coding, that is, designing the structure of programs, utilizing abstraction, managing states, and other OOP concepts(that's what I'm familiar with, I've started looking into functional programming). But I'm not very good at competitive coding.

Some of my classmate are good at competitive coding but the 'software' they create is just horrible (nested if/for/while blocks which are 5 levels deep, overly complicated code, stuff which can be simplified by just throwing in some POJO's).

Is the fact that I'm bad at competitive coding a symptom of something serious (weak foundations in algorithms/data structures)? Am I missing out on something?



Here's an more pragmatic take. Being good at competitive programming means you: -have good problem solving skills -can operate under time pressure -have a good understanding of algorithms and data structures

If you are bad at competitive programming, it most likely means you don't truly understand algorithms/data structures, and you have a weak problem solving foundation. It's harsh, but it's most likely true. The good thing is that you can improve your problem solving skills depending on the time you spend.

Does this affect you? If you want to work at FB/Google/Microsoft or any Big 4/FAANG company, you will need to be at competitive coding to some degree since all the interviews are based on these types of questions. If you want to excel in your job/get promoted quickly/go into management, then obviously other qualities and skills, especially networking, are 10x as important. But at the same time you will need to jump ship periodically to advance quickly in your career, which will require staying sharp and constant interviewing.

Overall, if you're an ambitious person that wants to excel in SV, competitive coding skills are paramount for interviewing. Of course, there are other ways to "make it": start-ups -> getting acquired/IPO/becoming a VC. So you don't need to go to FAANG. For those things, skills like people selection/business prioritization are 10x more important. If you don't give a shit about status/money, then you don't need to care about competitive programming because lower-tier companies won't care too much about that.

The bottom line is that it's not hard to learn OOP concepts/structure/abstraction or fucking whatever other coding guidelines there are. It's just a bunch of best practices. If I had to say it in one line, it would be that if someone is good at competitive programming, they can get good at designing software. The opposite is not necessarily true, because problem solving isn't something you learn in a day. So there will be more demand for people that are good at problem solving, who will be valued higher. Hope this helps.


Networking as in Social Networking or computer networking.


The former.


Peter Norvig, director of research at google, made some observations on this topic: https://www.reddit.com/r/programming/comments/44kpzk/peter_n...

I was somewhat involved in the programming Olympiads in high school and to a lesser degree icpc style programming in college.

And later when I founded my own startup - I thought these competitive programmer types would be great hires. But in reality it’s been a bit of a mixed bag. Real world software engineering is about readabiliy, maintenance, extensibility, etc - the actual data structure and algorithm work is typically minimal (which these competitive programmers relish on) and even then you’d probably want to delegate to some battle tested open source library.

Of course I don’t want to hold having a competitive programming background against the candidate but no longer prioritize that skill set.


No, in work coding is anything but a competition, if you want to do well in the work place your track record contributing to a free software project will give a potential employer a better idea of how you would do on their team than whether you win coding competitions.


Don't worry about it. Code competitions have different goals than what most people need/do with a CS degree.

As a metaphor, think of programming competitions as something like fencing. The best fencers have a good athletic ability.

There are jobs like fire/rescue which require a base level of athletic ability.

But that doesn't meant that a good fencer will be a good firefighter, or vice versa.

More specifically, there are ways to practice to be good at code competitions. You can get old tests and practice them. You can drill at writing some of the basic data structures so you can just crank them out. Some schools have programming teams where they do this sort of practice every week.

But these aren't part of the standard CS curriculum, almost certainly because it isn't that relevant to what most people want from a CS education - neither for students nor for potential employers.


Competitive coding signals that: * you can read (understand requirements) * visualise problem space * modify problem space * efficiently prune problem space is search of solution * have good understanding of DS and alorithms * command computer to help you finding solutions

I would say competitive programming is much more about math than software engineering.

I would say all these skills are useful to be good SE but you also need: * good code organisation * very good semantics skills (domain modeling, naming) * debugging skills (correlated to problem solving) * conversation skills (posing precise questions and answers) * beeing comfortable with ambiguity and change of requirements (especially startups) * being able to work with/fix shitty abstractions that less(sometimes "more") skilled people come up with

For average job even CS degree is overskill.


You tried to make bullet points by inserting a newline character before each asterisk, but it failed to generate the expected response. I wonder which of the aspects you brought up would have contributed to this problem from the HN engineer perspective :-)


I would hire you over a competitive coder.

Coding professionally is a long game with lots of human elements. Competitive coding is a short game where you only need to worry about the machine that's judging you.


It's a long game for the business. It can be a long or short game for the programmer.


Are you trying to say that by writing clean code one makes himself disposable?


I'm saying:

It's the goal of some engineers to write clean code for the benefit of the business.

It's the goal of some engineers to slap together something new and shiny, present it to management and get it approved for the benefit of their careers.

Engineers goals sometimes align with the business and sometimes don't.


They are saying that businesses are aligned with non-competitive coding.

Business software has multiple engineers working on it, but to do that the code needs to be clean enough for multiple engineers to work on it.


It's the difference between classical music & jazz.

You're a classical programmer, down to the book. Hit the keyboards just like you learned. It's sometimes good and very desirable.

However, when there's a party going on, and one is needed to freestyle, come up with new sounds and styles on the go, the preference is for a Jazzy programmer.

You can be both, and being one and the other is missing out. Sounds like you will thrive at an enterprise, but suffer at a start up. Now here's the crazy thing, even jazzy types can thrive at enterprise, they are usually the super heroes that wire up the core plumbing of the system. If they get into the ears of one of the high level Cs, they will be paid more than everyone else, they will come in fast with their cohorts, wire up the new system, and no matter how messy, the rest of the classical types get to play only on top of what they built.

Given the choice between being one or another. I rather be the competitive messy code, at least they can solve the problem. The worst thing I've seen is the classical clean programmer, who has "designed an amazing system, UML, nice code/directory layout" tons of clean code, comments, and the dang thing doesn't work.


I really like your classical vs jazz analogy, but I don’t think it applies here.

You can “jazzily” improvise your way through higher levels of abstraction just as much as you can immediate control flow. The folks OP describes aren’t really exhibiting a skill that’s useful in production at all. They’re just venturing out into the creative arts of coding. They break rules to do interesting things. Which is cool, and might sometimes correlate with commercially useful boldness or cleverness, but isn’t a particularly well-tuned signal.

The pressures of competitive coding can open up new ways of thinking about code and about problem solving. But there’s still a big leap from there to any kind of good engineering, startup or enterprise or other.

Idolizing the OP’s coders is only helpful if what they’re doing (competitive coding) is what you want to do. It doesn’f speak to commercial value.


On the other hand, the clean code can be fixed and updated later on, where the fancy mess sometimes just gets worse.

I remember once I found a series of if statements that were so convoluted I needed boolean logic to make sense out of it. In the end, it turned out that half of it was duplication. Nobody could make sense out of it so they simply added on to it each time they had to edit the file.

I'm not convinced that buggy clean code would be worse in that situation: the buggy code would have gotten fixed long ago because it would have been easy to see what was wrong and then fix it.


What the hell are you talking about? Stop spewing bullshit.


from my experience it's the other way around, 5 nested blocks might be a regular thing to see in an enterprise code base rather than at a startup.


I remember someone posted an HN post about tips for competitive programming. Some of the code I saw in there is horrific and I would never approve in a PR but definitely makes sense when you're coding with a time crunch.

In general, I would say while there might be some useful concepts there, you are not missing out. It's an interesting form of programming but not the same as what you would expect to do at work.

Terrible analogy but I'll go with it: just like how you'd probably never be expected to Iron Chef your way in a formal restaurant. You don't have a bunch of random ingredients and present what you can as long as it fits the theme. The customer asks what they want and if you don't have it or can't have it, making something else isn't acceptable most likely so the proper way to handle it is to ask the customer what they want instead and you give them your sincerest apologies.


I honestly forgot that competitive coding was a thing. I think I'd done it a few times in high school, but that was it.

If you weren't good at sprinting and running, would you be worried that you were a bad walker? Would you see it as a symptom of something serious? Of course not.


Funnily enough, I was at a programming competition that started just after your post.

I'm not sure how relevant it is for work, but its fun. I think people generally grow to the level of competency their environment demands of them. If you need to work on your problem solving at work, you can just work hard at trying to solve more problems at work and self-study in whatever way you like.

One angle though: its fun to work on this stuff. If you want a job where you can do more fancy problem solving and less plumbing, who knows, maybe somebody would hire you for winning one of these?


For me, what competitive coding, or practice of it, improves 2 skills: (1) solve an algorithmic problems and (2) translate ideas into code quickly and correctly.

The number 1 is not that essential. But the number 2 is somewhat essential for day to day work.

Being able to code faster for programmers is like being able to run faster for footballers. It's not everything obviously. But if you can code much faster, you will be a better programmer.

Being obsessed with coding speed is also like being obsessed with running faster. After a certain threshold, it's probably not that helpful.

Anyway, at first, I didn't believe that there would be anyone who could code like 5x-10x faster than me. From practicing a div-1 level-3 problem in topcoder.com, even if I read up the answer, it still takes me like 1-5 hours to implement a solution. A champion would take like 30 minutes including finding the solution.

It was like WTF moment. How could people be that different?

Be aware that somebody can code 10x much faster than you is probably what you might miss out. Once you are aware of that, you know you probably can practice, at least, to be 2x or 3x faster.


Without seeing your code its hard to say. I will say that I have worked with kids right out of college that the "competitive coding" mentality when writing software. They come up with a solution really fast, but the code ends up being very clever. The clever code ends up biting you 6 months down the road when you figure out what actually needs to be done.


> Is the fact that I'm bad at competitive coding a symptom of something serious (weak foundations in algorithms/data structures)? Am I missing out on something?

Maybe. Assuming equal practice/preparation time, they're smarter than you.

No big deal.


Do people actually think like this?

All it means is that they're better at what competitive coding tests for. There's nothing about being "smart."


What do you think being smart does for you, then?


Here we are thinking you're not very smart for making a comment like that.

The fact is that there is no single "smart". Instead there are many aptitudes, which combine and overlap to make people good or bad at specific skills.

Arnold Schwarzenegger was strong, but an average rock climber could best him at rock climbing. The average long distance runner could run laps around him.

We all understand this to be the case with respect to physical activities, but for some reason this idea of single-faceted intelligence persists.


I'm not positing single-faceted intelligence. (Which does exist, there are obvious kinds of brain problems that hurt you at every task.) I'm saying their intellectual talent is what makes them better than OP. Their natural ability. The stuff that's useful for programming contests, obviously. Low on geometry, high on logic and algebra, good for one-hour problems moreso than research, that sort of math.


You would be wrong. People being skilled in different environments does not mean they're more or less intelligent than others. Someone being poor at spelling bees would not a bad writer make for example.


Okay, so to settle this question, OP can ask these classmates what they got on the SAT.


If you think the SAT is in any way shape or form an indicator of intelligence or skills you would be objectively wrong. Someone with ADHD is likely going to perform poorly on the SATs due to the test environment but that does not indicate how well they'll perform in a professional environment.

Similarly I can think of people in college who would abuse Adderall in order to get higher scores. Do you think those people are more or less intelligent? Should we consider the metrics before or after usage?


This is a wild tangent that has nothing to do with OP's situation, which is that he went to a university with several classmates that are smarter than him/her. This is generally a good thing for your university to have.

And no, he doesn't have any hypothetical brain powers that make up for it.


You keep assuming that his classmates are smarter than them on the basis of one point of data. You're extrapolating so much out of a simple statement that it ventures into the realm of absurdity.

And you brought us into this wild tangent by implying that SAT scores are somehow indicative of general intelligence and asking the OP to see what they got on their SATs.


SAT scores are indicative of general intelligence, and a good double check that it isn't underpreparation with algorithms or less experience simply coding.

OP presumably isn't the smartest kid in his university. It's unlikely. Such is life.


Americans seem so obsessed with the SAT. Why do test scores matter so much to people? My friends and I used to compete with one another by writing IQ tests and comparing the results. It was sort of fun, but its not like the results meant anything. Especially since the scores went up the more we wrote the silly things. Did we get smarter? Clearly.


Try having a classroom discussion with kids that got 750 verbal score vs. kids that got 650. You'll see the difference.


I got a 750 verbal (680 math) and am quite stupid. Am I the exception that proves the rule?


No, 750 is pathetic. I got 850 verbal.


Competitive coding is not the measure or indicator of success.

Reminds me of competitive math contests in school, it didn't mean that the smartest people knew how to apply it to real life to solve problems for people that were valuable.

You absolutely have lots of value to learn, become, and add. Programming is about practice, practice, practice, so build, build, build.

Put in your time, never think you've arrived and you'll never stop arriving at cool things along the way.


I too am in the same boat. Never did much competitive coding, but am pretty decent at software development.

My colleague is good at both of them. And somewhere I feel, being good at competitive coding helps you develop an approach towards solving a problem. It also comes in quite handy when you have to make performance optimisation. Atleast that is what I observed with my colleague.

You should try to develop the logic by solving these questions!

Cheers


The data suggests that they are better than you at implementing some types of algorithms. Yes you are missing out in as much as they appear to possess skills that you don't.

Also competitive programming is tons of fun so I would say you're missing out by dismissing it.


Tone of OP's post doesn't suggesting he is dismissing it. He just isn't that good at it and doesn't have a natural interest. Of course he'd be well served trying to get better at it anyway for career reasons, but it's quite clear that there isn't a 1-1 mapping between Leetcode skills and actual software engineering as done by most organizations / companies out there.


One way to get better at coding on the fly is to just interview at many companies (that you have a genuine interest in). Practices makes perfect, as with everything else.


Why do you want to be a professional coder? Does everything have to be a competition?


Depends on what you mean by bad (how bad it is). It is definitely good to know basic algorithms and it is useful to learn to think that way. Ability to write code quickly is good too.

However, note that people who are good at competition literally trained writing common algorithms fast - there is zero value in that. I knew people who could write graph search with closed eyes in various vatiations and that made them save time in competition. That is irrelevant anywhere else. They also learn and train a lot more and harder algorithms - there is some but still little value in that unless you like it.

Tldr; if you struggle with algorithms 101 (binary tree, graph search, minimal path, etc), then it is good to learn them. If you are very slow, it is good to practice to become faster. Anything else is hobby/interest - do it if you like it, do it if you want to do it in the future.

Ability to write readable code actually valuable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: