Python for Coding Interviews - Everything you need to Know

Поделиться
HTML-код
  • Опубликовано: 1 июн 2024
  • 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
    Checkout my second Channel: @NeetCodeIO
    🥷 Discord: / discord
    🐦 Twitter: / neetcode1
    🐮 Support the channel: / neetcode
    ⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
    💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
    0:00 - Intro
    1:13 - variables
    2:40 - if statements
    4:00 - loops
    6:06 - math
    8:40 - arrays
    12:38 - sorting
    13:40 - list comprehension
    14:20 - 2d arrays
    15:25 - strings
    16:50 - queues
    17:30 - hash sets
    18:25 - hash maps
    20:15 - tuples
    20:55 - heaps
    22:30 - functions
    22:55 - nested functions
    24:20 - classes
    #coding #interview #python
  • НаукаНаука

Комментарии • 261

  • @NeetCode
    @NeetCode  Год назад +72

    🚀 All of the code is available at: neetcode.io/courses/lessons/python-for-coding-interviews
    Timestamps:
    1:13 - variables
    2:40 - if-statements
    4:00 - loops
    6:06 - math
    8:40 - arrays
    12:38 - sorting
    13:40 - list comprehension
    14:20 - 2-d arrays
    15:25 - strings
    16:50 - queues
    17:30 - hash sets
    18:25 - hash maps
    20:15 - tuples
    20:55 - heaps
    22:30 - functions
    22:55 - nested functions
    24:20 - classes

    • @myonlylovejesus887
      @myonlylovejesus887 Год назад

      What is the theme you are using brother?

    • @masternobody1896
      @masternobody1896 Год назад

      thanks

    • @andrewaranas8853
      @andrewaranas8853 Год назад +1

      @NeetCode graph theory course pls.

    • @jeevaalok1467
      @jeevaalok1467 Год назад

      @NeetCode i need a suggestion from you , i know python & c++ very well . so which one i should choose for interview purpose ? i mean which one is better ? please reply it really helps a lot

    • @marioamatucci
      @marioamatucci Год назад

      for queue I'd have mentioned something like
      ```
      from collections import deque
      q = deque([1,2,3],maxlen=3)
      print(q)
      q.append(-1)
      print(q)
      q.appendleft(-2)
      print(q)
      ```
      better than random op like here that does not show the queue essence :)

  • @perezident14
    @perezident14 Год назад +292

    This video came out less than 12 hours after I failed to pass a coding assessment question that I did using Python. I never wrote Python code, but JS wasn’t an option for the assessment. I somehow managed to make it to the next step of the interview and I am not taking this video for granted. Thank you so much! 🎉

    • @rj5697
      @rj5697 11 месяцев назад +5

      I started to learn Python before I did a web-dev bootcamp that was just JS. I have an interview assessment where JS isn’t available and I have to use Python, and making the switch back has been…difficult lol. So I’m with you as far as not taking this video for granted lol.

    • @user-qn5yf8bc1c
      @user-qn5yf8bc1c 3 месяца назад +1

      Bro how's that even possible ? What kindof questions they asked? Would be helpful to know

    • @NphiniT
      @NphiniT 2 дня назад

      I have interview in 15 minutes 😬

  • @SaiManasaPappu
    @SaiManasaPappu 7 месяцев назад +15

    This video is everything I've learned about Python in the last 3 months and more! Thanks for such on-point crisp content, and for putting it all in one single video unlike other RUclipsrs who make multiple never-ending clips with repetitive content

  • @macolulu
    @macolulu Год назад +38

    You are a true genius. The way you display the output is so easy to see. The comments on the code are so visual. By watching your videos I started to like practicing interview questions and algorithms in general and feel sorry that I was not learning algorithms in school in the clear way that you demonstrate to us. All in all, I am grateful that I found your channel.

  • @anujrana1509
    @anujrana1509 11 месяцев назад +16

    This is probably the best tutorial for someone who knows another programming language and wants to learn python. Thank you for the tutorial :)

  • @sabaamanollahi5901
    @sabaamanollahi5901 Год назад +19

    Thanks NeetCode! can't wait for your system design videos :)

  • @SamyuktaNeeraj
    @SamyuktaNeeraj 8 месяцев назад +3

    This is such a brilliantly constructed video! Thank you so much. Could not have learned all this python I need for interviews without your help!

  • @vladimirkim411
    @vladimirkim411 Год назад +4

    Thank you so much! Loved how concise and clear your examples are!

  • @AustinCS
    @AustinCS Год назад +15

    Not sure if it was mentioned or not, but for problems like path sum II it can be useful to understand deep copy vs shallow copy.

  • @535emon
    @535emon Год назад +2

    This is where I can get everything I need for coding part of my interview. Thanks Neetcode. You have given us enought

  • @nathanyao3525
    @nathanyao3525 Год назад +8

    this was exactly what i was looking for, thank you! Perfect timing

  • @dustinhxc
    @dustinhxc Год назад +2

    Wonderfully typed! Love the comments in the code! Thank you for this video!

  • @terrypark3690
    @terrypark3690 Год назад +3

    Great video I've been trying to get around to learning python and this is a great brief on what's different from other coding languages saved me so much time.

  • @Lewis64
    @Lewis64 Год назад +7

    This is the best cheatsheet for python syntax ever. Got a coding interview tomorrow, thank god you posted. ❤

  • @jaimelu2840
    @jaimelu2840 9 месяцев назад +2

    This is a great concise yet informative summary! Thank you!

  • @adamrizk6735
    @adamrizk6735 Год назад +2

    Great video as usual, loved how concise and straight to the point it is. You've convinced me to switch from Java to Python for interviews and programming puzzles 😁

  • @bombrman1994
    @bombrman1994 8 месяцев назад +2

    this was so good, I was like 50% confident with my python collection skills and now I am alot more confident. I can simply google what I know that exists even if i forgot the syntax. This is what I truly need content that can show me that something exists to know what to search. We don't know what we don't know

  • @harumambaru
    @harumambaru Год назад +10

    Thanks, I am using python at work for more than 6 years and heaps and nested functions was new and very useful info for me. 1:23 Short addition to printing that can save you time if you do a lot of prints print(f'{n=}') is the same as print('n = ',n)

  • @camilailges36
    @camilailges36 10 месяцев назад

    BEST video of all!! I'm also deep learning python for code interviews and this has made my life so much easier!!! Thanks so much. Your videos are the bests!

  • @midhunkrishnan5988
    @midhunkrishnan5988 Год назад +32

    I started learning DSA with Python today and I wanted a Python refresher. as I had lost touch with it. Luckily, I came across this video and I can't believe this 26 min covered all topics. Thank you so much!

  • @entertainmentadda1183
    @entertainmentadda1183 Год назад +1

    This video cleared alot of my small problems in for loops and lambda function. Good work brother.

  • @ankit28goyal
    @ankit28goyal 23 дня назад

    This is just amazing! I always look to refresh my python syntaxes after I stop coding in this language and waste time again and again. This video is so crisp and to the point.

  • @Hamun002
    @Hamun002 Месяц назад

    Thank you for providing this, need to get back in the saddle and things like this really help

  • @shelbypereira
    @shelbypereira 7 месяцев назад +4

    small note: it may be mentioned in the video but really the points on "arrays" are really discussing "lists". Arrays are distinct in python and available as part of the numpy package but generally only used for situations where memory is a consideration. Also true numpy arrays cannot be resized. For a nit picking interviewer this may be important. Video is excellent , great way to cram for an interview!

  • @Fahim_Ahmed22b
    @Fahim_Ahmed22b Год назад +1

    This is super useful!!!! Thank you so much NeetCode!!!

  • @piyusharyaprakash4365
    @piyusharyaprakash4365 11 месяцев назад +5

    you convinced me to change from javascript to python for coding interviews

  • @rajkumarv.b565
    @rajkumarv.b565 Год назад

    Thanks. Thanks a lot for this. I exactly looking for whether I can use python at big tech companies. You're really awesome.

  • @InfiniteNesLives
    @InfiniteNesLives 9 месяцев назад +1

    Thanks for the great and concise video! One suggestion I would have is to leave some of the printouts from the examples on the screen for longer so we have time to inspect and easily pause if need be. Some of the results are on the screen for so briefly before switching to new subject that have to be ready and quick with the pause button to press. Pressing run earlier would have helped greatly while you talked instead of talking about the expected result and leaving us in unnecessary anticipation.

  • @streambai1045
    @streambai1045 4 месяца назад

    I started to learn Python about two months ago, and this is the best training video for Python.

  • @dhanuufcdk
    @dhanuufcdk Год назад +2

    Great video. Good for refreshing python concepts

  • @picnicbros
    @picnicbros Год назад +18

    Used to solve most LeetCode problems using Java but thanks to you I picked up Python and agreed that it's much easier to use for interview problems where ideas are more important. This video is really helpful for me to perfect my Python skills

    • @Yoooyoooo286
      @Yoooyoooo286 2 месяца назад

      Heyy as indian can i solve dsa in python n gove job intevriew with python

  • @JaredT
    @JaredT Месяц назад

    This video gives me life. If this video would ever cease to exist, I’d cry.

  • @meetgandhi4176
    @meetgandhi4176 2 месяца назад

    At 7:09,
    The answer which is round off to -1 is definitely correct as -1.5 has been round to a bigger value to -1.
    It shows the value greater than or equal to 0.5 can be rounded off to correct value to its next greater integer value
    (1.5 can be rounded off to greater value 2 in positive no., and (-1.5) will be rounded off to greater value (-1) in negative no.)
    Yep, the explanation for it is awesome. Sometimes, its bit tricky for someone to find the particular negative value and might stuck over it.
    Thanks.!

  • @1243576891
    @1243576891 Год назад

    Very helpful. Thanks for the organization!

  • @sharadrao4893
    @sharadrao4893 Год назад +1

    WOW 🥺 I love you ❤️
    I am new to programming now I am programmer. Thanks

  • @diale13
    @diale13 7 месяцев назад

    The best tutorial for someone who knows another programming language and wants to learn python

  • @seshubeshu5959
    @seshubeshu5959 Год назад +4

    @NeetCode I really appreciate the quick refresher on python. I used it back in grad school and never touched it again. Would it be possible to break down every topic into an individual video that can be maintained as a playlist ? I may not be the sharpest tool in the box, however, it feels like certain sections of the current video are little fast.

  • @violetjellyfish2089
    @violetjellyfish2089 17 дней назад

    Отличное видео, большое спасибо! Очень удобно, что все чётко и посуществу, без длительных пауз и рассусоливаний

  • @asylzhantatibayev1538
    @asylzhantatibayev1538 Год назад +16

    I think the world rests on people like you.
    Thank you so much!!

  • @congwang171
    @congwang171 9 месяцев назад

    Thank you so much. This video helps me a lot.

  • @onomatopeia891
    @onomatopeia891 Год назад

    Thanks for the very informative video!

  • @silent7152
    @silent7152 Год назад

    exaaclty what i needed ... thanks man

  • @luisroxjimenez
    @luisroxjimenez Год назад

    This video helped a lot, thank you.

  • @akrammohamed8374
    @akrammohamed8374 5 месяцев назад

    The best video you've ever made is this one

  • @yuurishibuya4797
    @yuurishibuya4797 Год назад +1

    16:20 Ord() for ascii value! Nice intuitive function name, easy to remember. /s

  • @m04d10y1996
    @m04d10y1996 Год назад

    Thanks a lot for this video.
    Please make a video on how you learnt Java development and what resources you referred to and what was your strategy to learn and work in it.

  • @user-qo5pf6zz5z
    @user-qo5pf6zz5z 3 месяца назад

    Hi friend, love your channel, thank you so much for your efforts! I do have one suggestion, since you're teaching people to interview with Python, it might be helpful to follow PEP8 standards. Only interviewers with a background in Python will notice, however for experienced Python devs, not following the accepted style guidelines screams n00b which isn't ideal for interviewees trying to make a good impression. I know its a tiny detail which doesn't matter that much in the grand scheme because your channel is awesome and super helpful, however having more "Pythonic" style will definitely help junior devs put their best foot forward with more experienced Python folks.

  • @Kakashi75
    @Kakashi75 Год назад +2

    The most recent version of python released updated syntax allowing the use of increment ++ and decrement -

  • @goodwish1543
    @goodwish1543 Год назад +1

    Excellent! Hope to see more on System Design. ^_^

  • @pinguincoder
    @pinguincoder Год назад

    Im Not preparing for coding Interviews as im already a Software Developer in Germany. But I wan't to increase my ability To solve algorithm based Problems and my Problem solving skills in general and your Videos are absolute Gold!
    I'll definately will take a look into Python as im currently only working with c# which ist Kind of noisy for those Problems.

  • @alexandretrajano8927
    @alexandretrajano8927 3 месяца назад

    Thanks man, you helped me a lot! Damn useful!

  • @anselmobd
    @anselmobd 7 месяцев назад +1

    Great video! But, regarding the code shown at 6:30 of the video, I must clarify that the correct mathematical result of "-3 // 2" is "-2". This is because in the representation “Dividend = (divisor x quotient) + remainder”, the remainder must be non-negative. This is a widely accepted mathematical convention, and is useful in many applications. Thus, with the values in the example, the representation would be "-3 = (2 * -2) + 1". That said, be careful with "most languages" which are not consistent with mathematics. : )) Seriously, this may cause some error when coding some mathematical solution.

  • @9d6witch
    @9d6witch 3 месяца назад

    I needed this. Ive been coding but as a game dev, and my mentor who want me to enter software development say i have to learn the Logic of Python. Thanks for this...even though im still making games on the side 😂😂

  • @aussietramp
    @aussietramp Год назад

    New fan here. I gonna watch every single video and thumb up any of them!

  • @YusserAlQazwini
    @YusserAlQazwini 9 месяцев назад

    Great video, thank you.

  • @brunomonteiro3646
    @brunomonteiro3646 Месяц назад

    This channel is amazing

  • @zachary_burrows
    @zachary_burrows Год назад

    You rock dude, thank you

  • @miaowcat1
    @miaowcat1 Год назад +1

    I have been following along neetcode 150, and got a great offer, thanks!

  • @__sarik
    @__sarik Год назад +1

    Please also make a video regarding bisect function of py, it is also very useful. And also I have a question regarding heapq, what we should do if we want to have customized sorting?

  • @PyckledNyk
    @PyckledNyk 2 месяца назад

    Python is also a good intro to more complex languages since it uses a lot of coding conventions that can be found in other popular languages

  • @matheuscosta5330
    @matheuscosta5330 2 месяца назад

    Amazing content!

  • @Senick
    @Senick 3 месяца назад

    Excellent video 👍

  • @mnchester
    @mnchester Год назад

    Great video! Still seems unreal that there's no native way to support a max-heap without that awkward workaround. I was expecting better from Python :)

  • @md-ayaz
    @md-ayaz Год назад +1

    All good. I use python at work. When it comes to Object oriented design interviews Java/C++ works the best. Python falls short there.

  • @esteban-alvino
    @esteban-alvino 7 месяцев назад

    Thanks sir a lot of topics to Train kudos

  • @practicefirsttheorylater
    @practicefirsttheorylater Год назад

    perfect video for a longtime java user like me

  • @KrishnaDasPC
    @KrishnaDasPC 26 дней назад

    12:33
    Shortest way to reverse
    x = [1, 2, 3, 4]
    print(x[::-1])
    will print
    [4, 3, 2, 1]

  • @hlubradio2318
    @hlubradio2318 Месяц назад

    Nice what a comeback

  • @vasujain1970
    @vasujain1970 Год назад

    Wow, you're on fire!!

  • @soumalyadas1123
    @soumalyadas1123 4 месяца назад

    6:30 - that's why, we can better say it as *floor division*
    7:48 - can also be done with abs(), just in case, importing math isn't possible

  • @sigfigronath
    @sigfigronath Год назад +1

    Coming from Java this syntax is so bizarre to me ahaha, great video btw !

  • @Migsfigs
    @Migsfigs 8 месяцев назад

    Great video. Did you touch on linked lists? I might've missed it.

  • @Sgoose105
    @Sgoose105 Год назад

    it'd better call [1, 2, 3] as list, as oppposed to an array. I think array refers to numpy array

  • @marinablue9903
    @marinablue9903 Год назад

    Hi NeetCode, I'm wondering why your video about your internship experience at Capital One is not available now? That video was very interesting and wanted to see again since I got an offer from Capital One for TIP! Hope I can see that video again :)

  • @Mizaq
    @Mizaq Месяц назад

    7:13 int isnt really "rounding" the value. For -0,7 you would still get 0 if you make int() around it, yet the round should be -1 since its closer.
    Therefore int() is just deleting the values right after the dot, that in this case will be same as using math.ceil() for negative values.

  • @mukeshnayal624
    @mukeshnayal624 10 месяцев назад

    nice content ! will you make it for advance questions.

  • @ivan6990
    @ivan6990 2 месяца назад

    thanks my dude

  • @ahmedtremo
    @ahmedtremo 2 месяца назад

    so good thanks

  • @cardorichard4148
    @cardorichard4148 8 месяцев назад

    It'd be great if you did this for JS ❤

  • @tomundisclosed2343
    @tomundisclosed2343 Год назад

    for the nonlocal val, the function doubles val locally still, as when i print val by itself afterwards I don't get it doubled

  • @krishnadass4365
    @krishnadass4365 Год назад

    Neetcode, I'm tripped on the 2-D list thing a bit. Especially this [[0]*4] * 4 -> why does changing one value, affect all values?

  • @sarthakgupta290
    @sarthakgupta290 Год назад +2

    For guys like me who are switching from Java to Python for LeetCoding, this is really helpful!

    • @harshivam
      @harshivam 11 месяцев назад

      why you're shifting?

    • @sarthakgupta290
      @sarthakgupta290 11 месяцев назад +3

      @@harshivam Python syntax is much shorter and easier to write. I am NEVER EVER going back to Java for coding interviews

    • @hritikroshanmishra3630
      @hritikroshanmishra3630 2 месяца назад

      @@sarthakgupta290 is it good go in coding interview with python??????

    • @sarthakgupta290
      @sarthakgupta290 2 месяца назад

      @@hritikroshanmishra3630 Absolutely

  • @venkateshmaliga659
    @venkateshmaliga659 2 месяца назад

    Python doesn't have tree set /ordered set,
    Tree map /ordered map which are using self-BST so what are alternative to it in python to use those ?
    Sorted containers are not built in with python So
    That's leaves to bisect module ,but it uses binary search not red black trees so
    What do u think?

  • @neelakshisoni6118
    @neelakshisoni6118 Год назад

    Hey..Thanks for the video...Can u plz make a video on what to put in a resume for carcking Google interview

  • @Suraj.5260
    @Suraj.5260 2 месяца назад

    Thank u bhai !!

  • @JonathanChongNg
    @JonathanChongNg Год назад

    Thank you 🙏

  • @patrickateng4348
    @patrickateng4348 11 месяцев назад

    So, What exacly would I need to be a front end engineer? I'm sort of confused! I've done HTML and CSS and currently doing javascript. Should I drop Javascript and start python? If not, how far should I learn Javascript to be considered 'okay' by an interviewer to be able to use python in coding interviews?

  • @moulidharanshanmugam3031
    @moulidharanshanmugam3031 29 дней назад

    at 15:16 it is said that the values would change for all the sublist when created by the format [[0]*n]*n. If the reason is that it creates the same value, then why does the other values change when I do the same with [0]*n

  • @ZhenglinLi
    @ZhenglinLi 7 месяцев назад +1

    From Java to Python here! Love the concise of Python and hate we must complete 2 DSA problems in 45 min interviews.

    • @andiuptown1711
      @andiuptown1711 5 месяцев назад +1

      Why hate?

    • @nischit727
      @nischit727 3 месяца назад

      ​@@andiuptown1711 probably because due to the time restriction

  • @sefasarac2839
    @sefasarac2839 5 месяцев назад

    Hello I want to ask a question. Is it necessary to use array modules (like numpy,array) in python or can we solve it with lists ? Because in reality there are some differences with real arrays and lists. But do they care about in DS & Algorithm interview ? As I understand from your video they dont.

  • @sreelekhabasina2791
    @sreelekhabasina2791 2 месяца назад +1

    Best best best❤

  • @DodoLP
    @DodoLP Год назад

    the modulo and minus modulo is because of how its mathematically written

  • @AdityaGowda2000
    @AdityaGowda2000 Год назад

    is there any module for balanced binary tree in Python like std::set in C++. Because some algorithms like Dijkstra's work better with balanced binary tree than hash map.

  • @NG-bd6di
    @NG-bd6di Год назад +1

    Regarding the 2d arrays tip @15:16: Could you provide an example of how the "wrong" method would become an issue? I understand that it's basically 4 "clone" rows of zeros, rather than unique rows. But messing around with both methods, I can't get figure out when this difference would become a problem. Thanks!

    • @NeetCode
      @NeetCode  Год назад +7

      If you were using it to store information, if you update one row it will update all of the rows in the same position. This would be troublesome for DP problems or graph problems.

    • @user-qt1uj2hr9v
      @user-qt1uj2hr9v 4 месяца назад

      you can use .copy() tho

  • @oshogarg5215
    @oshogarg5215 3 месяца назад

    Can you please make more videos similar to this for Python , thanks

  • @KannanMavila
    @KannanMavila Год назад

    Really good list. Love how concise it is.
    You missed something important though: taking input from file and from console

  • @ding8880
    @ding8880 Год назад +1

    Yo just want to let you know that I can't afford the paid version now. But someday in the future when I have a better job imma buy a few and gift others as a token of appreciation.

  • @wentao5742
    @wentao5742 3 месяца назад

    super useful

  • @Thekingslayer-ig5se
    @Thekingslayer-ig5se Год назад +1

    Is this good for data analysts also ?

  • @boltonkim7090
    @boltonkim7090 Год назад +1

    There are quite a few problems that can use sorted trees that guarantee log(n) for basic operations (add, remove and contains). It seems Python does not have anything built-in? I'd love to switch from Java to Python but this limitation is kind of a deal breaker. I know sortedcontainers and blist exist but they aren't available on most interview platforms. How do you deal with this?

    • @slh4176
      @slh4176 Год назад

      Same here

    • @botousai
      @botousai Год назад +1

      Make up a method and tell your interviewer "I know this structure doesn't exist in python, but I am going to pretend that we have it here". They don't care about your white board being perfect python code. They care about if you can solve the problem, how you think/communicate, etc.