The topic of today's video has been requested
by a number of people who've left comments
about this topic on numerous videos on this channel.
So I finally got around to doing it today.
We're talking about competitive programming.
So we're gonna go through and find out
what competitive programming is,
some of the information about how it works.
Then hopefully I'll answer for you, by the end of the video,
whether competitive programming is something
that you wanna do or look further into.
So without further ado, let's get into that right now.
This video is bought to you
by the Learn Programming Academy's
Data Structures and Algorithms course.
Having a firm understanding of algorithms
and data structures will make you a better
and more employable programmer.
Learn the strengths and weaknesses of data structures,
as well as many commonly used algorithms
all explained in data with code.
Visit ipa.dev/youtubealgorithms
or click the link in the description below.
(upbeat music)
Welcome back, my name is Tim Buchalka
with another programming tip of the day
and we're talking about competitive programming.
Now do you want to see more videos like this?
If you do, then click on the subscribe button
and that bell notification and that way you'll be up to date
and you won't miss any videos that are similar to this one.
All right, so let's talk about now, competitive programming,
as I've mentioned, what is competitive programming?
Well, I like to use an analogy here,
so let's think about a sport where you're competing
against other people, or weightlifting.
Now obviously in weightlifting,
the idea is to lift the most weight
and you're competing against other people to do that.
And over time people get eliminated
if they can't lift a certain weigh.
And eventually there's someone who's left over
who basically wins, 'cause they lifted the heaviest weight.
Now in competitive programming, we're not using our muscles,
we're not losing weights,
but we're not using physical muscles,
we're using brain muscle, brain power if you will.
And we're creating, we're completing I should say,
challenges that have been created for us,
by people who are actually running
the competitive programming contests or competitions,
in which there are a lot of 'em.
So that presents you with a problem
and you need to solve that problem in computing terms
by creating a programme to do so.
But, the real kicker is you need to do it
as quickly as possible.
So the whole idea of competitive programming
is on getting something that works,
that actually meets the requirements that are given to you.
So it has to actually solve a particular problem,
but also has to be done as quickly as possible.
Now quickly as possible in a sense of getting it completed
in the amount of time you've been allocated,
but there are also other stipulations often there
that your solution may have to complete or compete.
Compete, I'll get it right this time,
in a certain amount of time.
So for example, I might say whatever the solution is
it has to execute and take no longer than
one second to do so.
And you'll find that there's a judge, an online judge,
who you'll upload your version, your solution
and they'll go through that and run that
and verify that that actually works in the amount of time.
And also that you basically how much time
you've actually taken to write that,
is also calculated and stored somewhere as well.
Now, it's usually done on a number of rounds.
So you can start from round one,
there might be, say there's 500 people competing,
the people who don't make it to the end of round one,
people who don't finish the solution
in the given amount of time or whose solution is incomplete
or doesn't work or takes too long to execute,
they will get eliminated and then you move to round two.
And there's another challenge,
and you keep moving through till eventually,
you get to a final round and there's a winner award
and someone will eventually win that,
completing the last challenge that's been assigned to them
in the quickest amount of time.
And depending on the type of competition that's out there,
you might find that that will take you onto other things
and eventually you could even get to a huge competition
where there's lots of cash prizes and other sorts of prizes.
So it can be quite a thing where you can actually make money
if you're the type of person
who can really work well under pressure
and complete a lot of these challenges quickly.
Now a lot of these contests or competitions
have actually got high score titles
and these points that you're owning,
it can continually help those
appointed or allocated to your account.
And that means that someone can go back and see the history
and they can see the archive,
oh, Tim has got 5000 points here
and they can compare themselves to you.
So there's this letter that's available.
And the secret way to check your progress
against to other people
and see how you're going against them.
But again, the point I wanna stress here
is that competitive programming is all about
getting something done as quickly as possible.
Getting it done really, really fast.
Now sometimes you'll get to decide
on the programming language to use,
but other times, you'll have to use the language
that the person that you're providing the solution to,
is actually, no, or is basically saying
that they'll receive.
So they might come back to you for example and say
I'm only going to accept C++ and C for a challenge.
So you'll need to go in there knowing ahead of time
what language to use.
So often, they'll accept multiple languages
so you maybe have to do a big job of Python, C+ Parcel C.
But keep in mind again, being competitive,
it's coming down to time and your solution takes
1 1/2 seconds and another solution takes a second,
now if the stipulation was
that it needed to be no more than one second long,
then you might be eliminated for that.
So for that reason, often C++ is a language
that's heavily promoted but I've seen competitions
on all sorts of different languages.
And you're not necessarily eliminated purely
because of your choice of language,
but just keep that in mind as well.
And not to mention, there's usually an online grader,
almost, always an online grader who will take your solution,
so there's a submission process.
You get your code working in your favourite IDA,
then you'll copy and paste that, upload it
and they'll actually verify that.
And once they've verified that it's working,
you will then go and post that and you can view the points
that you've completed at a certain time.
And however the calculation is or the amount of time,
how quick it is, will be added to your account.
Right, so with that said,
we now know what competitive programming is.
Why would you wanna do competitive programming?
Well, as you can probably imagine,
you'll probably become a better programmer
thanks to this process.
And you're testing yourself against other,
in many cases, elite developers.
So it can be something that will really
put your back to the wall
and really they'll help your skills
and you'll get better at problem-solving,
because you really need to think on your feet
and come up with solutions really quickly.
Now often the problems that you need to solve,
here's another big one,
are used in interview, are interview questions,
at large companies like Google, et cetera, et cetera.
So the more that you understand
and are able to compete with these,
or complete these competitive programming challenges,
that's going to help you for technical interviews,
because you've actually been through these processes.
So these questions that are often asked,
similar questions, at interviews.
So that's a good way to brush up on those skills
if you wanna do that.
Right, so what are the prerequisite skills
that you need to have to get into competitive programming?
Well, in general, you need know,
have you really have a good knowledge
of your chosen programming language?
This isn't something generally
that I recommend for beginners,
just because of the nature of what you're doing here.
You're needing to come up with a solution fast,
so it means that you should really have a good understanding
of programming languages.
But also, I would suggest you also need
good understanding of data structures,
because you'll be using those in your solution
and probably algorithms as well.
So with that said, who is this,
we talked about who it's not aimed for,
so let's talk about who it's aimed for now.
Because I've talked about beginners, probably not suitable.
Beginners in general are not gonna be suitable
because they haven't really got those core skills
that are needed.
You really need to have some experience with programming.
But it's really aimed more at the people
who know something about it.
They've got a good level of programming skill
and are looking to take their results to the next level.
They're really wanting to go through this as an exercise
so that they can answer technical questions
at interviews down the trek,
but also just to become better programmers
because the more coding you do in general,
the better you get at programming.
Now, one really big advantage of competitive programming
is it can be really worthwhile
if you like working under pressure.
Now you often get that in your career as a programmer.
You may need to think under pressure,
you'll need to come up with a solution quickly
and that can be a good thing
because this is what this is all about.
It's all about the clock is ticking all the time
and you need to come up with a solution really fast.
And that can be exhilarating if you're the type of person
who works well under pressure.
And obviously contrasting that,
if you're not that type of person, you don't like pressure,
you might find competitive programming
is not quite fair for that purpose.
Now one bad thing though, about competitive programming
is that it can teach you bad skills, believe it or not.
So when you get a job,
if you carry working like you've done now,
like a competitive programmer,
where you're trying to get something finished
as quickly as possible,
well, that can lead to rushing a solution
and can lead to bad programming practises.
Because obviously in a job in the real world,
it's not necessarily just about completing it
in the fastest possible time,
it's making sure that you're using best practises,
your solution work, it works,
so it's been thoroughly tested.
It works well with an existing code base
and so on and so forth.
And in fact, further to that, Google have actually come out
and said that they've found, interestingly enough,
that people who excel and win at competitive programming,
that can be seen as a negative factor
when they actually go for a job.
And that's for that reason,
that basically there's someone's rushing
because they're so used to doing that
as a competitive programmer,
may actually not be a great fit for a job,
but until they realise they need to slow down
and think a little bit more about the process
before they actually get to the stage
of just putting, start typing, in other words.
So thinking of architecting a solution
instead of just rushing to finish it as quickly as possible.
There is no doubt though you will get better a programming
if you go through competitive programming
and that's purely the case
because you're actually doing more programming.
And I would suggest for that reason
it's maybe worth a look.
And the other thing to keep in mind
is that it might even be worth just to try it
and just knowing that you're not gonna try
and get to be the best of the best,
but just to enter a competition, try it out
and just see how you go.
Try not to get too discouraged and just remember
that these types of events, contests and competitions
for competitive programming, tend to draw out the elite.
And so you really will be competing
against the best of the best in many cases.
So if you're not getting the results
you think you should be getting,
just keep in mind that you are competing at that level.
But it's probably worth a shot
but just don't get too discouraged obviously,
if you're not getting the results you want.
I see it as something that is there,
it's something that some people will probably love,
particular is people who love
to put themselves under pressure.
But it's certainly not for everyone.
So for that reason, if you think you've got the skills,
give it a whirl.
Amazing, you made it to the end of the video.
If you're interested in more programming tutorials,
click on the top rectangle over here.
But if you're interested in programming tutorials,
click on the bottom rectangle down there.
And if you're interested in subscribing to this channel,
and why wouldn't you be?
Click on the subscribe button up here.
Hope forward to catching you in another video.