Python for Coding Interviews - Everything you need to Know

  Рет қаралды 532,670

NeetCode

NeetCode

Күн бұрын

Пікірлер: 311
@NeetCode
@NeetCode 2 жыл бұрын
🚀 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
@anonforever123
@anonforever123 2 жыл бұрын
What is the theme you are using brother?
@masternobody1896
@masternobody1896 2 жыл бұрын
thanks
@andrewaranas8853
@andrewaranas8853 2 жыл бұрын
@NeetCode graph theory course pls.
@jeevaalok1467
@jeevaalok1467 2 жыл бұрын
@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 :)
@JaredT
@JaredT 8 ай бұрын
This video gives me life. If this video would ever cease to exist, I’d cry.
@perezident14
@perezident14 2 жыл бұрын
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 Жыл бұрын
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.
@GokulPonnappanPillay
@GokulPonnappanPillay 10 ай бұрын
Bro how's that even possible ? What kindof questions they asked? Would be helpful to know
@NphiniT
@NphiniT 7 ай бұрын
I have interview in 15 minutes 😬
@zaboomafia
@zaboomafia 5 ай бұрын
What was the coding problem you were provided?
@shelbypereira
@shelbypereira Жыл бұрын
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!
@SaiManasaPappu
@SaiManasaPappu Жыл бұрын
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 KZbinrs who make multiple never-ending clips with repetitive content
@anujrana1509
@anujrana1509 Жыл бұрын
This is probably the best tutorial for someone who knows another programming language and wants to learn python. Thank you for the tutorial :)
@SAURABHKUMAR-uk5gg
@SAURABHKUMAR-uk5gg 4 ай бұрын
This is the best video I have seen on using Python for anything
@macolulu
@macolulu 2 жыл бұрын
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.
@yomanthunder
@yomanthunder Ай бұрын
Thanks a lot for the video , this very help when you have background in c++ and planning to switch to python for problem solving and interviews
@anubhavsharma8357
@anubhavsharma8357 2 жыл бұрын
Thanks!
@meetgandhi4176
@meetgandhi4176 9 ай бұрын
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.!
@imransjourney
@imransjourney Ай бұрын
This isn't the python helper video for the interviews. This is the best recap/crash course video ever published on Python in the world.
@Lewis64
@Lewis64 2 жыл бұрын
This is the best cheatsheet for python syntax ever. Got a coding interview tomorrow, thank god you posted. ❤
@piyusharyaprakash4365
@piyusharyaprakash4365 Жыл бұрын
you convinced me to change from javascript to python for coding interviews
@Kolya3578
@Kolya3578 2 ай бұрын
Broooo same….
@NiharikaSharma-i6v
@NiharikaSharma-i6v Ай бұрын
this video is seriously amazing. it literally covers so many concepts from interview POV
@sabaamanollahi5901
@sabaamanollahi5901 2 жыл бұрын
Thanks NeetCode! can't wait for your system design videos :)
@streambai1045
@streambai1045 Жыл бұрын
I started to learn Python about two months ago, and this is the best training video for Python.
@midhunkrishnan5988
@midhunkrishnan5988 2 жыл бұрын
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!
@peterwanjihia2372
@peterwanjihia2372 Жыл бұрын
how is it going ??
@ephremtadesse3195
@ephremtadesse3195 7 ай бұрын
I found this tutorial to be the most precise yet packed with fascinating details! For kicks, I totally get all the Java lingo!
@harumambaru
@harumambaru 2 жыл бұрын
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)
@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
@ammarh.6288
@ammarh.6288 2 ай бұрын
This video is insane for people who've already been programming but not in python, thank you neetcode god
@picnicbros
@picnicbros 2 жыл бұрын
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
@Gamekiladhi7
@Gamekiladhi7 9 ай бұрын
Heyy as indian can i solve dsa in python n gove job intevriew with python
@bombrman1994
@bombrman1994 Жыл бұрын
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
@ankit28goyal
@ankit28goyal 8 ай бұрын
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.
@diale13
@diale13 Жыл бұрын
The best tutorial for someone who knows another programming language and wants to learn python
@AustinCS
@AustinCS 2 жыл бұрын
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.
@RegularGuyJake
@RegularGuyJake 4 ай бұрын
This video was so good! Took a ton of notes to prepare for my upcoming interview. Actually learned some very cool tricks! Didn't know that nonlocal trick, I've been just returning my data structures out of my functions and passing them around that way my whole life!
@SamyuktaNeeraj
@SamyuktaNeeraj Жыл бұрын
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!
@asylzhantatibayev1538
@asylzhantatibayev1538 2 жыл бұрын
I think the world rests on people like you. Thank you so much!!
@NeetCode
@NeetCode 2 жыл бұрын
Np 🙂
@Kakashi75
@Kakashi75 Жыл бұрын
The most recent version of python released updated syntax allowing the use of increment ++ and decrement -
@nathanielyao3525
@nathanielyao3525 2 жыл бұрын
this was exactly what i was looking for, thank you! Perfect timing
@0nlypets_world
@0nlypets_world Ай бұрын
10:48 not including index 3 means value 4 13:04 if u want to reverse the custom sort since default is asc but u can do? arr.sort(key=lambda x:len(x) reverse='true')
@dustinhxc
@dustinhxc 2 жыл бұрын
Wonderfully typed! Love the comments in the code! Thank you for this video!
@carlossilva6579
@carlossilva6579 3 ай бұрын
Very helpful! I studied Python a few years ago, but I didn't remember many things in this video. Thanks!
@Frawkesish
@Frawkesish Ай бұрын
Thanks you. This was so damn helpful ! I have been putting thiss off too long but what looked like gibberish a year ago makes a ton of sense now. 🎉
@terrypark3690
@terrypark3690 2 жыл бұрын
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.
@vladimirkim411
@vladimirkim411 2 жыл бұрын
Thank you so much! Loved how concise and clear your examples are!
@Hamun002
@Hamun002 8 ай бұрын
Thank you for providing this, need to get back in the saddle and things like this really help
@camilailges36
@camilailges36 Жыл бұрын
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!
@soumalyadas1123
@soumalyadas1123 11 ай бұрын
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
@jaimelu2840
@jaimelu2840 Жыл бұрын
This is a great concise yet informative summary! Thank you!
@anselmobd
@anselmobd Жыл бұрын
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.
@Based1776
@Based1776 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 😁
@entertainmentadda1183
@entertainmentadda1183 Жыл бұрын
This video cleared alot of my small problems in for loops and lambda function. Good work brother.
@YIXINHU-dy9gl
@YIXINHU-dy9gl 3 ай бұрын
the most helpful video I've ever watched for python code interviews
@yuurishibuya4797
@yuurishibuya4797 Жыл бұрын
16:20 Ord() for ascii value! Nice intuitive function name, easy to remember. /s
@sharadrao4893
@sharadrao4893 2 жыл бұрын
WOW 🥺 I love you ❤️ I am new to programming now I am programmer. Thanks
@InfiniteNesLives
@InfiniteNesLives Жыл бұрын
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.
@KrishnaDasPC
@KrishnaDasPC 8 ай бұрын
12:33 Shortest way to reverse x = [1, 2, 3, 4] print(x[::-1]) will print [4, 3, 2, 1]
@mgicdood
@mgicdood 11 ай бұрын
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 😂😂
@sarthakgupta290
@sarthakgupta290 Жыл бұрын
For guys like me who are switching from Java to Python for LeetCoding, this is really helpful!
@harshivam
@harshivam Жыл бұрын
why you're shifting?
@sarthakgupta290
@sarthakgupta290 Жыл бұрын
@@harshivam Python syntax is much shorter and easier to write. I am NEVER EVER going back to Java for coding interviews
@hritikroshanmishra3630
@hritikroshanmishra3630 9 ай бұрын
@@sarthakgupta290 is it good go in coding interview with python??????
@sarthakgupta290
@sarthakgupta290 9 ай бұрын
@@hritikroshanmishra3630 Absolutely
@atifzia124
@atifzia124 4 ай бұрын
But in some companies they don't even mention python as an option to write code.
@jeremynx
@jeremynx 4 ай бұрын
thank you. I refreshed everything in python in 26 mins
@PyckledNyk
@PyckledNyk 9 ай бұрын
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
@Mizaq
@Mizaq 8 ай бұрын
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.
@shubhadeepgoswami1633
@shubhadeepgoswami1633 4 ай бұрын
Amazing video very crisp content . Thanks for making this !!
@rajkumarv.b565
@rajkumarv.b565 2 жыл бұрын
Thanks. Thanks a lot for this. I exactly looking for whether I can use python at big tech companies. You're really awesome.
@aussietramp
@aussietramp 2 жыл бұрын
New fan here. I gonna watch every single video and thumb up any of them!
@NeetCode
@NeetCode 2 жыл бұрын
Thank you 🙏
@amospan14
@amospan14 2 жыл бұрын
Really, really appreciate you my man! This video is exactly what I needed. Your hard work does not go unnoticed. You deserve all the recognition and praise for putting together an incredibly thoughtful and well presented Python for coding interviews video.
@Vukobratina
@Vukobratina Жыл бұрын
this is great. Thanks for your time and effort bro. Personally for me, you talk really fast, so I suggest 0.75 speed in 'runtime;. lol
@TobyCrocker
@TobyCrocker 10 ай бұрын
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.
@Ideolog-f7b
@Ideolog-f7b 3 ай бұрын
You just need to be honest with the interviewer that you use python only for coding interviews. They will understand. One only needs to learn just enough python to pass coding interviews.
@Test-br2sm
@Test-br2sm 5 ай бұрын
There is a way to generate the max heaps in Python. The heapq's module has "_heapify_max" and "_heappop_max" methods. You can test it with this code: "import heapq test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] max_heap = heap._heapify_max(test) while test: print(heapq._heappop_max(test))" I'm not sure why they created them as a protected member of the module, but this is absolutely working fine.
@violetjellyfish2089
@violetjellyfish2089 7 ай бұрын
Отличное видео, большое спасибо! Очень удобно, что все чётко и посуществу, без длительных пауз и рассусоливаний
@Fahim_Ahmed22b
@Fahim_Ahmed22b 2 жыл бұрын
This is super useful!!!! Thank you so much NeetCode!!!
@akrammohamed8374
@akrammohamed8374 Жыл бұрын
The best video you've ever made is this one
@WarpingWombat
@WarpingWombat 2 жыл бұрын
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.
@diegogallardo8281
@diegogallardo8281 Ай бұрын
I just want to point out that -x % y = z is mathmatically correct. Having the remainder be a negative number is incorrect. This is because it is based on the division theorem where Divident = (Divisor x Quotient) + remainder
@md-ayaz
@md-ayaz 2 жыл бұрын
All good. I use python at work. When it comes to Object oriented design interviews Java/C++ works the best. Python falls short there.
@dhanuufcdk
@dhanuufcdk 2 жыл бұрын
Great video. Good for refreshing python concepts
@studywithjames
@studywithjames 8 ай бұрын
Can someone help me with 15:12 from my understanding, using "x = [0] * 3" creates [0, 0, 0], but all 0's are same object but its okay since we usually do "x[0] = 1", creating a NEW object. It is now [1, 0, 0]. But still, 0's are same object so, use the "=" sign to make NEW object. Now 2D array makes it harder. x = [[0] * 2] * 2 x[0][0] = 1 We could think that since using "=", it will only update [0][0]. But no. We are using "*" TWICE. (x = [[0] * 2] * 2). X is an object inside of an object. meaning, it will give [[1,0],[1,0]] To make a NEW object, we change the highest object. In this case, x[0] = [1, 0] thats why it sucks to use (x = [[0] * 2] * 2) in 2D array. You need to make a brand new one from scratch like x[0] = [1, 0].
@thecompanioncube4211
@thecompanioncube4211 Ай бұрын
this has screwed me so many times. Such weird thing to keep in back of your mind
@moulidharanshanmugam3031
@moulidharanshanmugam3031 8 ай бұрын
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
@ahmadhawasli1294
@ahmadhawasli1294 5 ай бұрын
BIG thank you! ❤
@sigfigronath
@sigfigronath 2 жыл бұрын
Coming from Java this syntax is so bizarre to me ahaha, great video btw !
@junaidkhankhan4260
@junaidkhankhan4260 6 ай бұрын
Amazing I find it hard to shift from java to python due to these kind of differences
@seshubeshu5959
@seshubeshu5959 Жыл бұрын
@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.
@CertifiedDeadMemes
@CertifiedDeadMemes Жыл бұрын
Doing an interview for a role that will primarily use python tomorrow, if I get the job, I'll subscribe to NeetCode's only fans
@NeetCode
@NeetCode Жыл бұрын
Good luck, you got this!!!
@andiuptown1711
@andiuptown1711 Жыл бұрын
Update
@CertifiedDeadMemes
@CertifiedDeadMemes 11 ай бұрын
they took forever to get back to me buy\t, yes I'm starting on Monday! @@andiuptown1711
@goodwish1543
@goodwish1543 2 жыл бұрын
Excellent! Hope to see more on System Design. ^_^
@1243576891
@1243576891 Жыл бұрын
Very helpful. Thanks for the organization!
@ZhenglinLi
@ZhenglinLi Жыл бұрын
From Java to Python here! Love the concise of Python and hate we must complete 2 DSA problems in 45 min interviews.
@andiuptown1711
@andiuptown1711 Жыл бұрын
Why hate?
@nischit727
@nischit727 11 ай бұрын
​@@andiuptown1711 probably because due to the time restriction
@waiziiii
@waiziiii 5 ай бұрын
A great video for people who are already comfortable coding in other programming languages and want to learn python! Thanks man!
@SaravananD
@SaravananD 6 ай бұрын
Brilliant as usual 🙂
@m04d10y1996
@m04d10y1996 2 жыл бұрын
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.
@नाम_में_क्य़ा_रखा_है
@नाम_में_क्य़ा_रखा_है 17 күн бұрын
Can you provide the good resource for 15:15. It is difficult for me to comprehend.
@nicholasscotto3712
@nicholasscotto3712 4 ай бұрын
an array is a list? and a hashmap a dictionary? yes?
@gyanendravishwakarma5974
@gyanendravishwakarma5974 2 ай бұрын
Array is not a list because array stores homogeneous data type while list stores heterogeneous data type
@latestupdate69
@latestupdate69 Ай бұрын
Not exactly. Look alike for comparison. List and dict has other features also.
@mnchester
@mnchester 2 жыл бұрын
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 :)
@silent7152
@silent7152 2 жыл бұрын
exaaclty what i needed ... thanks man
@alexandretrajano8927
@alexandretrajano8927 10 ай бұрын
Thanks man, you helped me a lot! Damn useful!
@congwang171
@congwang171 Жыл бұрын
Thank you so much. This video helps me a lot.
@youpremium175
@youpremium175 5 ай бұрын
OMG YOU ARE A LIFESAVER
@sreelekhabasina2791
@sreelekhabasina2791 9 ай бұрын
Best best best❤
@Senick
@Senick 11 ай бұрын
Excellent video 👍
@prithvivenkatesh327
@prithvivenkatesh327 7 ай бұрын
Hi! 15:13 - can this part be explained in detail? By the way, thanks much for the amazing content you share!
@Sgoose105
@Sgoose105 Жыл бұрын
it'd better call [1, 2, 3] as list, as oppposed to an array. I think array refers to numpy array
@luisroxjimenez
@luisroxjimenez 2 жыл бұрын
This video helped a lot, thank you.
@10minutes_cs
@10minutes_cs 4 ай бұрын
collections can be of dynamic type , note how elements are integer , string ``` from collections import deque queue = deque() queue.append(1) queue.append("ab") queue.append(1) print(queue) mySet = set(queue) print(mySet) myMap = {} myMap["abc"] = 1 myMap[1] = "abc" print(myMap) ``` output ``` deque([1, 'ab', 1]) {1, 'ab'} {'abc': 1, 1: 'abc'} ```
@10minutes_cs
@10minutes_cs 4 ай бұрын
if you dont want end line ``` print("Hello", end="") print("World") ``` output : ``` HelloWorld ```
@10minutes_cs
@10minutes_cs 4 ай бұрын
u can add any string to end = "" , so print("Hello") is same as print("Hello", end=" ")
@Eternal-j2j
@Eternal-j2j Жыл бұрын
arr.sort(key=lambda x:len(x)) == arr.sort(key=len) its same
@brunomonteiro3646
@brunomonteiro3646 8 ай бұрын
This channel is amazing
@onomatopeia891
@onomatopeia891 2 жыл бұрын
Thanks for the very informative video!
@SushmithaSathyanarayanan-u4l
@SushmithaSathyanarayanan-u4l 5 ай бұрын
How do u juggle between different languages? I might end up googling built in libraries if I juggle, which is not good for interviews
@matheuscosta5330
@matheuscosta5330 9 ай бұрын
Amazing content!
@ding8880
@ding8880 2 жыл бұрын
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.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 541 М.
Top 6 Coding Interview Concepts (Data Structures & Algorithms)
10:51
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 249 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
10 Important Python Concepts In 20 Minutes
18:49
Indently
Рет қаралды 417 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 702 М.
Top 8 Data Structures for Coding Interviews
14:00
NeetCode
Рет қаралды 164 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 680 М.
8 Design Patterns EVERY Developer Should Know
9:47
NeetCode
Рет қаралды 1,1 МЛН
Please Master This MAGIC Python Feature... 🪄
25:10
Tech With Tim
Рет қаралды 95 М.