How I would learn Leetcode if I could start over

NeetCodeIO
26 May 202418:03

Summary

TLDRThe speaker emphasizes the value of mastering data structures and algorithms through LeetCode challenges, despite their difficulty compared to traditional academic subjects. They argue that while most full-stack jobs might not require this knowledge, it is still beneficial and can lead to high-paying positions. The speaker shares their personal journey and offers advice on how to effectively learn and practice coding problems, stressing the importance of repetition, understanding core algorithms, and the 'why' behind solutions. They also highlight the need for curiosity and critical thinking to truly grasp complex problems, advocating for a structured approach to learning similar to that experienced in school.

Takeaways

  • 🚫 The speaker does not encourage grinding LeetCode but acknowledges its value in improving coding skills and securing high-paying jobs.
  • πŸ“š Despite most full stack jobs not requiring knowledge of data structures and algorithms (DSA), having a foundational understanding is still beneficial.
  • πŸ’‘ The speaker argues that learning DSA is similar to learning other subjects in school that may not be directly applicable to one's job but are still valuable.
  • πŸ”„ LeetCode problems can be more challenging than traditional academic subjects due to their complexity and the need for a systematic approach to solve them.
  • 🀯 The speaker emphasizes that LeetCode is difficult and can be frustrating, but it's not about intelligence; it's about the learning process and methodology.
  • πŸ“ˆ The speaker learned LeetCode by studying solutions for hours, trying to understand why they worked, and then attempting to explain them in video form.
  • πŸ”‘ The process of learning LeetCode involves understanding core algorithms and practicing them repeatedly to build familiarity and speed.
  • 🎯 The speaker suggests that the goal should be to master core algorithms rather than just solving LeetCode problems quickly.
  • 🧠 Understanding 'why' an algorithm works is crucial for being able to apply it effectively to different problems, which requires deep thinking and curiosity.
  • πŸ“ The speaker recommends using pen and paper to work through examples and think about edge cases to reinforce understanding.
  • πŸ”„ Repetition is key in learning LeetCode, similar to how children learn basic math through repeated practice.

Q & A

  • Why does the speaker believe that grinding LeetCode is worthwhile despite its difficulty?

    -The speaker believes that grinding LeetCode is worthwhile because it can lead to high-paying jobs and has personally changed their life, including securing a job at Google.

  • What does the speaker suggest is the main difference between LeetCode problems and other academic challenges they've faced?

    -The speaker suggests that the main difference is not the level of difficulty, but rather the process and methodology required to solve LeetCode problems, which is more about systems and repetition than raw intelligence.

  • What is the speaker's opinion on the necessity of understanding data structures and algorithms for most full stack jobs?

    -The speaker acknowledges that most full stack jobs do not require knowledge of data structures and algorithms, but they still argue that having a basic understanding is useful.

  • Why does the speaker emphasize the importance of repetition when learning from LeetCode?

    -The speaker emphasizes repetition because it is a fundamental way humans learn, and it is particularly important for mastering the core algorithms and problem-solving techniques required for LeetCode.

  • What is the speaker's advice for someone who is struggling with LeetCode problems?

    -The speaker advises to focus on mastering core algorithms like binary search, DFS, BFS, and sliding window through repetition and practice, rather than jumping into complex problems.

  • How does the speaker compare the learning process of LeetCode to learning math or physics?

    -The speaker compares the learning process by stating that while LeetCode is difficult like math and physics, it is not more difficult, and the key to mastering it is through the same process of repetition used in learning math or physics.

  • What is the speaker's view on the common mistake people make when solving LeetCode problems?

    -The speaker believes the common mistake is not practicing repetition. People often think they understand a solution after seeing it once, but without repetition, they are unable to recall and apply the solution effectively later.

  • What is the speaker's recommendation for the initial target when solving LeetCode problems?

    -The speaker recommends that the initial target should be to get really good at core algorithms and not necessarily to solve LeetCode problems quickly.

  • Why does the speaker suggest that understanding 'why' an algorithm works is important for solving LeetCode problems?

    -The speaker suggests that understanding 'why' an algorithm works is important because it allows for a deeper comprehension that goes beyond memorization, enabling one to apply algorithms effectively to a variety of problems.

  • What role does the speaker believe curiosity plays in truly mastering LeetCode problems?

    -The speaker believes that curiosity is essential for mastering LeetCode problems because it drives the learner to ask questions, think about why solutions work, and explore creative examples and edge cases.

  • How does the speaker feel about the structure and discipline imposed during childhood learning and its application to adult learning?

    -The speaker feels that the structure and discipline imposed during childhood learning, such as repetition and note-taking, are very useful and should be applied to adult learning as well, as they help in mastering complex subjects like LeetCode problems.

Outlines

00:00

πŸ“š Embracing the Challenge of LeetCode

The speaker starts by addressing the common misconception that LeetCode is useless for real-world development. They argue that while full-stack jobs may not require deep knowledge of data structures and algorithms, understanding core algorithms is beneficial. The speaker shares their personal experience, stating that LeetCode significantly improved their career prospects, even leading to a job at Google. They acknowledge the difficulty of LeetCode problems, comparing it to academic challenges faced in high school and college, and emphasize the importance of persistence and learning from solutions to improve.

05:01

🧠 The Difficulty of LeetCode and the Importance of Repetition

The speaker delves into why LeetCode problems can feel more challenging than traditional academic subjects, attributing it to the learning process and methodology. They reminisce about their own learning journey, highlighting the lack of comprehensive resources in the past and the difficulty of understanding complex solutions without proper explanations. The speaker stresses the importance of repetition in learning, drawing parallels to how children learn basic math. They argue that the lack of practice and repetition is a common mistake made by those attempting LeetCode problems, and suggest that revisiting and re-solving problems is key to mastering the concepts.

10:02

πŸ” Mastering Core Algorithms Through Repetition

Building on the concept of repetition, the speaker advises focusing on mastering core algorithms like binary search, DFS, BFS, and sliding window. They emphasize that becoming proficient in these algorithms should be the initial goal, rather than quickly solving complex LeetCode problems. The speaker shares their personal strategy of implementing algorithms multiple times to reduce the cognitive load when facing medium difficulty problems. They argue that this approach allows for more mental capacity to focus on applying algorithms to problem-solving, rather than recalling how to implement them.

15:05

πŸ€” The 'Why' Behind Algorithm Efficiency and Problem Solving

The speaker discusses the importance of not just knowing how to implement algorithms, but also understanding why they work and why they are efficient. They suggest that this deeper understanding is crucial for tackling more complex problems and for being able to solve problems for the first time. The speaker encourages learners to spend time pondering the 'why' behind solutions, to think creatively about examples and edge cases, and to practice explaining their thought process. They emphasize that this approach, combined with the structured learning habits often instilled during childhood, is essential for truly mastering LeetCode problems.

Mindmap

Keywords

πŸ’‘LeetCode

LeetCode is an online platform that provides a collection of coding challenges to help software engineers prepare for technical interviews. In the context of the video, LeetCode is referenced as a resource for practicing coding problems that can lead to high-paying jobs, particularly in the tech industry. The speaker emphasizes the difficulty and the value of grinding LeetCode problems, even though they are more challenging than traditional academic subjects.

πŸ’‘Data Structures and Algorithms (DSA)

Data Structures and Algorithms (DSA) refer to the fundamental concepts in computer science that allow for efficient storage and manipulation of data. The video discusses the importance of DSA knowledge, suggesting that while it may not be required for all jobs, it is still beneficial. The speaker argues that understanding core algorithms is useful, even if not directly applied in everyday work.

πŸ’‘Full Stack Jobs

Full Stack Jobs refer to positions that require knowledge and skills across both front-end and back-end development. The script mentions that most full stack jobs do not require knowledge of data structures and algorithms, but the speaker still advocates for the value of understanding these concepts as part of a well-rounded skill set.

πŸ’‘Academic Difficulty

Academic Difficulty in the video is used to describe the level of challenge faced when studying subjects like AP Calculus and physics. The speaker contrasts this with the difficulty of LeetCode problems, suggesting that coding challenges on LeetCode are even more challenging than these academic subjects.

πŸ’‘Methodology

Methodology in this context refers to the systematic approach one uses to learn and solve problems. The video emphasizes that the difficulty of LeetCode problems is not just about intelligence, but rather about the systems and methodologies one employs to tackle them effectively.

πŸ’‘Repetition

Repetition is a learning technique where one practices a skill or concept multiple times to reinforce understanding and proficiency. The speaker argues that repetition is key to mastering LeetCode problems and draws a parallel to how children learn basic math through repeated practice.

πŸ’‘Core Algorithms

Core Algorithms are fundamental procedures in computer science that solve common problems, such as binary search, DFS (Depth-First Search), and BFS (Breadth-First Search). The video stresses the importance of becoming proficient in these algorithms as a foundation for tackling more complex LeetCode problems.

πŸ’‘Binary Search

Binary Search is a search algorithm used to find the position of a target value within a sorted array. The script uses binary search as an example of a core algorithm that should be deeply understood and practiced to the point of being able to implement it quickly and efficiently.

πŸ’‘Problem Solving

Problem Solving in the video refers to the process of analyzing and finding solutions to coding challenges, particularly those found on LeetCode. The speaker discusses the importance of not just understanding the solutions but also being able to apply them to new problems.

πŸ’‘Competitive Programming

Competitive Programming is a high-pressure activity where programmers compete to solve a set of problems in a limited amount of time. The video implies that the skills developed through solving LeetCode problems can be beneficial for those interested in competitive programming.

πŸ’‘Understanding 'Why'

Understanding 'Why' in the context of the video means comprehending the reasoning behind why a particular solution or algorithm works. The speaker suggests that this is a crucial aspect of mastering LeetCode problems, as it allows one to apply knowledge to new and unfamiliar problems.

Highlights

The speaker emphasizes that while LeetCode is challenging, it is not necessarily more difficult than other technical subjects, but requires a different learning approach.

LeetCode problems are academically difficult and can be harder than college classes, but the speaker argues that the difficulty is due to the learning process rather than intelligence.

The speaker shares personal experience, stating that grinding LeetCode changed their life and helped them secure a job at Google.

The importance of understanding core algorithms is highlighted, as they form the basis for solving more complex LeetCode problems.

The speaker discusses the lack of good resources in the past for understanding LeetCode solutions and the difficulty of learning from them.

A comparison is made between learning LeetCode and learning math or physics, emphasizing the need for a systematic approach to problem-solving.

The concept of repetition in learning is introduced as a key strategy for mastering LeetCode problems, similar to how children learn math.

The speaker explains that understanding solutions to LeetCode problems is not enough; one must practice and internalize the knowledge through repetition.

The importance of practicing basic algorithms like binary search until they can be implemented quickly and without much thought is discussed.

The speaker argues that the goal should not be to solve LeetCode problems quickly, but to deeply understand and be able to implement core algorithms efficiently.

The process of learning is compared to carrying numbers in addition, where understanding the process is more important than just getting the answer.

The speaker suggests that the difficulty in re-solving LeetCode problems stems from not truly internalizing the solution the first time.

The value of re-solving LeetCode problems to reinforce learning is highlighted, comparing it to the way children learn through repetition.

The speaker provides a detailed example of how to practice binary search and other algorithms repeatedly to build proficiency.

The importance of not just memorizing algorithms but understanding why they work is emphasized for truly mastering LeetCode problems.

The speaker encourages the use of pen and paper to work through examples and understand the 'why' behind algorithms and solutions.

The video concludes with the speaker reflecting on the usefulness of childhood learning strategies like note-taking, repetition, and structured learning for mastering LeetCode.

Transcripts

play00:00

how would I grind elak code if I could

play00:02

start all over again I'm going to try to

play00:04

make some points that are honestly

play00:06

pretty simple but I think you probably

play00:08

haven't heard most of them before and

play00:11

quickly before I start someone always

play00:13

comments leak code is useless save your

play00:15

time doing real development blah blah

play00:17

blah it's completely true I've never

play00:19

encouraged people to grind leak code

play00:21

I've only like told them how to do it

play00:23

it's true that most full stack jobs

play00:25

don't require knowledge of data

play00:26

structures and algorithms I would still

play00:28

personally argue that DSA knowledge is

play00:30

still useful at least understanding like

play00:32

the core algorithms but you know what

play00:34

else is true you probably went to school

play00:37

for 20 years of your life learning a lot

play00:40

of things that you aren't going to use

play00:42

at your full-time job that doesn't mean

play00:45

learning those things was useless from

play00:48

my perspective if spending a couple

play00:50

months grinding leak code can get me a

play00:52

really high-paying job then honestly I

play00:54

don't care how useless it is because

play00:57

leak code literally changed my life even

play00:58

if I didn't create like the YouTube

play01:00

channels the fact that I was able to get

play01:02

a job at Google just because I grinded

play01:05

leak code seems pretty worthwhile to me

play01:07

and I think it's a life-changing job for

play01:09

most people but how do you actually get

play01:12

good at leak code let me explain when I

play01:15

first started doing leak code problems I

play01:17

realized this is the most academically

play01:22

difficult thing I've ever done in my

play01:25

life I had taken AP Calculus and physics

play01:29

and a bunch of really difficult things

play01:31

in high school and in college honestly

play01:33

college for me was a little bit easier

play01:35

than high school I remember everyone

play01:36

would always say you know high school is

play01:38

hard but wait until you get to College

play01:39

college is going to be really hard

play01:41

that's when you're going to have to

play01:41

learn how to study and improve your

play01:43

study habits and everything for me I

play01:46

think when I took my first programming

play01:47

class in college that's when I struggled

play01:49

a little bit but after that at least for

play01:51

me I went to a pretty average college it

play01:53

was relatively easy I'm not going to lie

play01:55

but you know what was difficult when I

play01:57

started hitting leak code problems I

play01:59

wish somebody had told me you know leak

play02:00

code is not easy this is the hardest

play02:02

thing you're probably going to do to get

play02:04

a job it's going to be harder than all

play02:06

of your classes that you've ever taken

play02:08

when I took my first programming class

play02:09

like I said I struggled a little bit at

play02:11

the beginning so for me programming is

play02:13

actually harder than these other

play02:14

technical subjects but now I tell myself

play02:17

I was just in that like machine learning

play02:19

phase where I was just taking in a bunch

play02:21

of new data understanding how to use it

play02:23

and then eventually I got familiar with

play02:25

it and then I was good I wish I could

play02:27

say the same thing about leak code every

play02:30

time you think you're good at it you see

play02:31

a crazy problem and it just destroys

play02:34

your confidence it's completely

play02:36

different than anything you've ever seen

play02:37

before so what is so different about

play02:41

leak code than everything else is it

play02:43

really harder than everything like when

play02:45

I was doing it I just thought damn I

play02:47

guess I'm just not smart enough I

play02:48

thought I was a genius my whole life

play02:50

doing everything so easily getting A's

play02:52

whenever I wanted to but damn this thing

play02:55

I just can't do it I don't think it's

play02:57

about intelligence at all believe it or

play02:59

not it's about systems it's about

play03:01

processes it's about methodology how

play03:04

you're doing it at least that's my

play03:05

opinion and I'm going to try to convince

play03:06

you why first let me show you how I

play03:09

learned leak code when I first started

play03:12

you have a problem a hard problem median

play03:14

of two sorted arrays it's the fourth

play03:16

leak code problem imagine how many

play03:18

people came across this problem and just

play03:20

wanted to jump out the window after of

play03:22

course most people can't solve it so

play03:24

what do you do well back in the day leak

play03:25

code didn't really have articles and

play03:27

editorials and even this one is payal so

play03:30

you end up going to the solutions tab it

play03:32

used to be called the discuss tab

play03:34

nowadays if you go here you'll click one

play03:37

of these and man you'll see this

play03:40

beautiful explanation look at this this

play03:42

guy's explaining it with hints with

play03:44

everything doesn't have any pictures in

play03:46

here but sometimes they even have

play03:47

pictures you know it's reasonable to be

play03:50

able to understand one of these

play03:51

Solutions you can see this one was

play03:53

recent right 2023 back in my day though

play03:56

we didn't have that this is what we used

play03:58

we used these Solutions and also Lee

play04:02

2115 if you've heard of him but look at

play04:04

this like look at this solution first of

play04:07

all just look at it crazy solution and

play04:10

not much of an explanation given okay

play04:12

the second one is I guess a little more

play04:15

reasonable I don't know even though the

play04:17

third one is definitely a little bit

play04:19

more reasonable there's not really much

play04:21

of an explanation you go down here you

play04:23

don't see much of an explanation at

play04:25

least back in the old day like 2019 when

play04:27

I was doing it everybody's just asking

play04:29

can you actually explain it and nobody

play04:31

did okay the best you'd get is like five

play04:33

comments here so I know I make videos on

play04:36

these problems and sometimes I don't do

play04:38

a perfect job either but you have to

play04:40

realize that it's tough love okay I

play04:42

can't explain every little detail in a

play04:44

20-minute video I can do the best to

play04:46

give you like the intuition of why a

play04:48

solution works even that in my opinion

play04:50

is a lot easier than how I learned this

play04:53

is how I learned I would look at these

play04:54

Solutions you know for hours and hours

play04:56

try to figure out why they worked and

play04:58

finally when I did I would try to make

play04:59

like a video explanation for it

play05:01

thankfully now we do have a lot better

play05:03

resources but even then leak code is

play05:06

still not easy why isn't it easy so if

play05:09

I'm arguing that leak code actually

play05:12

isn't much more difficult than math or

play05:14

physics or some other highly technical

play05:16

subject that you have learned before why

play05:18

does it feel so much different and I

play05:21

think one big reason is the process the

play05:24

methodology the way that you learned

play05:26

these things versus the way that you're

play05:28

trying to learn this let me just kind of

play05:31

rewind take you back through time and

play05:34

remind you how did you learn math when

play05:37

you were a kid you probably first

play05:39

learned how to count like 1 2 3 4 and

play05:43

just learned the base 10 digit system

play05:45

and then you probably learned bigger

play05:47

digit numbers 100 110 234 something like

play05:51

that and you were able to then start

play05:53

adding numbers together 1 plus 2 and

play05:56

then bigger digit numbers 3 4 five one

play06:00

two three do you think if I successfully

play06:03

explain to a child how to solve this

play06:06

problem and they are able to do it they

play06:08

are able to take these digits and add

play06:11

them together and get that big number

play06:13

and then I make it more complicated and

play06:15

I teach them how to carry a number to do

play06:17

like more complex addition maybe

play06:19

subtraction if I show them how to do

play06:21

that just a single time or maybe even

play06:24

several times in the same day and then

play06:27

maybe a week later a month later I show

play06:30

them the same thing and they don't

play06:31

practice in between that week or month I

play06:34

give them a similar problem do you

play06:36

really think they'd be able to solve it

play06:38

probably not unless they're really

play06:39

really smart the point I'm making is you

play06:41

could teach somebody how to do something

play06:44

difficult they do it a single time they

play06:46

think they understand how to do it but

play06:48

if a bunch of time goes by you're

play06:49

probably not going to be able to do it

play06:51

again kids learn the same way adults do

play06:54

with repetition right so that's a pretty

play06:56

simple answer repetition so why don't

play06:59

more people do it I mean it just sounds

play07:01

so simple why don't more people do

play07:03

repetition when it comes to leak code

play07:05

let me kind of explain the classic

play07:06

problem people make when they solve leak

play07:08

code problems let's say they're solving

play07:11

a medium binary search problem and I bet

play07:15

you most people who try to solve a like

play07:18

medium level binary search problem

play07:20

they're probably not even super good at

play07:22

like basic binary search but okay they

play07:24

try to do it it takes them probably some

play07:27

cognitive energy to even Implement basic

play07:29

binary search you know if it takes you

play07:31

10 minutes to implement basic binary

play07:33

search that's a problem you shouldn't

play07:35

even be attempting medium problems if it

play07:37

takes you you know 10 minutes to figure

play07:40

out that this number is

play07:42

234 why are you doing addition you don't

play07:44

even know what this number represents

play07:46

right you got to get really really good

play07:47

at the basics before you kind of take

play07:49

steps beyond that but okay just

play07:51

contining you get to a medium binary

play07:53

search question you realize that it's a

play07:54

binary search question but you still

play07:56

can't solve it all you have is your

play07:58

basic binary search algorithm

play07:59

implemented then you look at the

play08:00

solution it takes you maybe 1 hour to

play08:03

understand the solution but you're able

play08:05

to do it you write your code you kind of

play08:07

really exercise your brain muscles you

play08:09

write it and now you're done for the day

play08:11

then you continue solving leak code

play08:13

problems maybe a month later you solve

play08:16

another medium binary search question

play08:18

you're not able to solve it you look at

play08:19

the solution it takes you some time to

play08:22

figure out the solution once you realize

play08:24

it's binary search you feel bad you

play08:26

realize it's similar to a problem you've

play08:28

already solved but you weren't able to

play08:30

figure it out again why not because you

play08:33

tricked yourself you think you

play08:36

understand the solution and maybe you

play08:37

did for a very short time but that

play08:39

didn't really sink in and it's not your

play08:42

fault when you're learning something

play08:43

that's genuinely difficult like if

play08:45

you're reading the solution to a problem

play08:48

it's difficult and you think you

play08:50

understood it which you might have but

play08:52

it didn't sink in so of course you need

play08:55

repetition it's such a simple answer

play08:57

isn't it just practice but then why

play08:58

isn't anybody doing it this is how you

play09:00

learn pretty much everything in life

play09:02

when you learn how to read it takes

play09:04

practice why don't people do it when it

play09:06

comes to leak code I don't know but

play09:08

let's be honest I made the same mistake

play09:10

until I realized this I thought like huh

play09:12

I did so well in high school I did so

play09:14

well in math and physics so why am I so

play09:16

bad at leak code because the way I'm

play09:18

practicing it isn't enough leak code is

play09:21

difficult it's difficult like math and

play09:22

physics but it's not more difficult you

play09:25

could not teach somebody how to count

play09:27

and add numbers and divide numbers

play09:29

numers in a relatively short time

play09:31

without practicing so now let me try to

play09:33

give more concrete advice on how to

play09:37

practice how to actually do repetition

play09:40

because even that isn't as

play09:41

straightforward as you might expect

play09:43

first of all there are certain core

play09:45

algorithms algorithms like binary search

play09:48

DFS depth for search breath for search

play09:50

sliding window and a bunch of other kind

play09:53

of core algorithms that I talk a lot

play09:54

about on this channel as well as like

play09:56

you can check a lot of this stuff out on

play09:58

n code. but my personal advice to you

play10:02

would be get really really good at these

play10:05

Basics practice them a lot you can do

play10:08

that at the same time that you're

play10:09

solving leak code problems or you can do

play10:11

it before you start solving leak code

play10:13

problems but you want to get good at it

play10:15

and I promise you it won't take you that

play10:17

long the Target that most people set

play10:20

when they're solving leak code problems

play10:22

is I want to be able to look at a Le

play10:24

code problem and solve it quickly that

play10:26

in my opinion is the wrong target you

play10:28

should get really good at just core

play10:31

algorithms that should be your target at

play10:33

least that should be your first Target

play10:35

and binary search it's a very short

play10:37

algorithm what is it like less than 10

play10:39

lines of code I think every computer

play10:41

science student learns it maybe the

play10:43

first time you do it it'll take you like

play10:44

30 minutes or an hour to like fully

play10:47

understand it okay the next time you

play10:48

implement it should probably take you

play10:49

like half that 15 minutes the third time

play10:52

you do it I bet it'll take you like 10

play10:54

minutes and the fourth time probably

play10:56

like 8 minutes eventually you should get

play10:58

to a point where you can imp M this in

play11:00

less than 5 minutes I could probably do

play11:01

it in like 30 seconds to be honest cuz

play11:04

it's not that much code you could say I

play11:05

memorized it or you could say I deeply

play11:07

understand it you could say whatever you

play11:09

want but the point is I could implement

play11:10

it very quickly so now when I get to a

play11:13

medium difficulty leak code problem the

play11:16

binary search aspect of that problem is

play11:18

Trivial to me it's like 1 two three like

play11:21

number systems it takes me no cognitive

play11:23

energy to focus on implementing binary

play11:25

search or understanding why it works

play11:28

understanding why it's efficient any of

play11:29

that doesn't take me any time to get to

play11:31

this level suppose it just takes you

play11:33

like implementing binary search five

play11:34

times and I probably implemented it you

play11:36

know dozens of times but there is like

play11:38

diminishing returns if you can Implement

play11:40

binary search 10 times in the period of

play11:43

like a week or a month you can probably

play11:45

get just as good at it as I am some of

play11:47

these other algorithms are probably a

play11:48

little more difficult DFS BFS but the

play11:51

same idea can be applied to those

play11:53

Implement these five times 10 times

play11:56

whatever it'll probably take you a few

play11:57

hours to do that let's say say 4 hours

play12:00

to implement it like 10 times now you

play12:02

don't understand you have such a big

play12:05

Advantage when you look at leak code

play12:06

problems now like you really don't

play12:08

understand it until you've experienced

play12:10

it when you've been in my shoes many of

play12:11

you who are good at leak code probably

play12:13

know the feeling these things are so

play12:15

trivial to you that Medium problems can

play12:18

also be a lot easier now you actually

play12:21

have the brain capacity to focus on how

play12:24

you can take these algorithms and

play12:25

actually apply them to a medium problem

play12:28

which takes a lot of energy you're not

play12:30

kind of juggling two things at once

play12:32

you're not trying to re-remember how do

play12:34

I Implement BFS and also how do I apply

play12:37

it to this difficult problem you're not

play12:39

doing that I don't know why when

play12:41

somebody solves a leak code problem and

play12:43

then they look at the solution they feel

play12:45

bad about that but they look at the

play12:46

solution they're able to solve it why

play12:47

not solve the same problem the next day

play12:50

why not do you think you're going to

play12:51

lose anything by doing that I guess it

play12:53

takes time but if that problem is fresh

play12:55

in your mind it might not take you more

play12:57

than like 15 minutes so why not do it

play12:59

you're reinforcing something that is

play13:02

good I promise you anybody who's really

play13:04

really good at leak code or a really

play13:06

good competitive programmer this stuff

play13:08

is literally like ABCs to them you have

play13:11

to do that to get good you can call it

play13:14

cheating you can call it memorizing but

play13:16

that's just how it is and I know for a

play13:18

lot of people this isn't fun but in my

play13:20

opinion it's pretty fun being able to go

play13:22

into an interview and be able to solve

play13:23

it and get you know a high-paying job as

play13:25

a result even if you agree with

play13:27

everything I've said so far there is

play13:29

some more Nuance to this leak code is

play13:31

more difficult than just what I've

play13:32

talked about here some problems are

play13:34

definitely more difficult than just

play13:36

taking something and applying like a

play13:37

core algorithm to that problem I'm

play13:39

specifically talking about hard problems

play13:41

and even some medium problems I think

play13:44

the next level of getting good at this

play13:46

stuff is similar to what I'm talking

play13:48

about repetition practicing in a smart

play13:50

way but I think the next level is asking

play13:53

the question why does something work

play13:56

most people think math is just

play13:58

memorizing memorizing numbers formulas

play14:00

you have some formula fals ma in physics

play14:03

once you know what the force is the mass

play14:05

is the acceleration is you just take

play14:07

those values you plug them in and then

play14:09

you get some value as a result that's

play14:12

what people think math is what math

play14:14

really is is being able to argue why the

play14:18

math works in the first place AKA proofs

play14:22

right you might have taken a discret

play14:23

math class in college or some other

play14:25

class where you had to do math proofs

play14:27

and this is kind of the second compon

play14:29

component to leak code problems in my

play14:31

opinion the more complicated component

play14:33

you might have looked at a leak code

play14:34

solution or watched one of my videos

play14:36

even though the algorithm made sense it

play14:38

might have been an algorithm you're

play14:39

familiar with you still didn't fully

play14:42

understand why it worked and the why is

play14:44

so important because if you want to be

play14:47

able to solve a problem for the first

play14:50

time you have to really understand why

play14:53

the repetition I talked about before

play14:55

will only take you so far what I'm

play14:57

getting at is it's not just about being

play15:00

able to quickly write out the DFS

play15:02

algorithm or BFS algorithm from scratch

play15:05

it's about understanding exactly why it

play15:08

works I try my best in my videos to

play15:11

explain this but it's not always easy

play15:13

unless I want to make like an hour long

play15:15

video my advice to you for figuring this

play15:18

stuff out is just spending some time

play15:20

thinking about it I know that's kind of

play15:22

an obvious answer but it's the only

play15:24

answer nobody can force you to do it no

play15:26

matter how well of a resource you find

play15:29

whether it's an article or a video

play15:30

nobody can go in your brain and actually

play15:33

force you to think about why something

play15:36

works and you do need a little bit of

play15:38

curiosity for that for example there is

play15:41

an algorithm called two pointers it's

play15:43

applied in many cases to like binary

play15:45

search you need two pointers and in

play15:46

sliding window you need two pointers and

play15:48

there's a condition in problems where

play15:50

you'll have something like while the

play15:53

left pointer is less than the right

play15:55

pointer this is the condition sometimes

play15:58

though you'll have the while left is

play16:00

less than or equal to right and I've had

play16:02

some people ask me the question how do

play16:04

you know whether it's this or whether

play16:07

it's less than or equal and they try to

play16:09

memorize it but I don't think it's worth

play16:12

memorizing I think you have to really

play16:14

look at the context of the problem and

play16:17

figure out why that's the case the

play16:19

easiest thing would be to come up with

play16:22

some examples I think people watch my

play16:24

videos sometimes because I'll have like

play16:26

an example and walk through it why can't

play16:28

you you do that by yourself why can't

play16:30

you bring out a pen and paper and just

play16:32

walk through an example by yourself is

play16:35

it because you're lazy because I promise

play16:37

you I wouldn't have gotten good if I

play16:39

didn't do this drawing and I only do the

play16:41

drawing for my videos when I'm

play16:43

practicing something by myself I'm using

play16:45

pen and paper so if you're the type of

play16:47

person when you get stuck you just kind

play16:48

of go blank you just stare at your

play16:50

screen you're just thinking in your head

play16:52

try to do something else try to type out

play16:54

some notes some comments as you're

play16:56

trying to code up a solution or you know

play16:57

use pen and paper if not doing that

play16:59

you're missing out I promise you anybody

play17:01

who's really really smart only got good

play17:04

at it by practicing by thinking of

play17:06

creative examples by thinking of edge

play17:08

cases that would maybe break a solution

play17:11

or maybe would reinforce a solution and

play17:13

explain why exactly that solution works

play17:16

I think if there's anything that you

play17:17

have learned from this video it's that a

play17:20

lot of the things you did as a kid and

play17:22

maybe you stopped doing as an adult were

play17:25

very very useful to you like taking

play17:27

handwritten notes explaining your

play17:29

thought process repetition even boring

play17:32

repetition even doing something so many

play17:34

times to the point where it just gets so

play17:35

boring that's kind of what math class

play17:37

was as a kid those things are useful

play17:39

like the structure that is forced on you

play17:41

when you're a kid is very very useful

play17:44

and I think having too much Freedom as

play17:46

an adult is not when you have like eight

play17:48

hours in a day it's easy to

play17:50

procrastinate but when you're a kid you

play17:52

have like one hour with this class a

play17:54

second hour in Spanish class or whatever

play17:56

and that kind of you know structure is

play17:58

pretty useful full when it comes to

play17:59

learning there's a reason why everybody

play18:01

does it all around the world

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
LeetCode MasteryAlgorithm LearningProblem SolvingTech InterviewData StructuresCareer AdviceGoogle JobsEducational InsightsCoding PracticeCompetitive Programming