Practice Makes Perfect

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ก.ย. 2024
  • 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
    🧑‍💼 LinkedIn: / navdeep-singh-3aaa14161
    🐦 Twitter: / neetcode1
    ⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
    #neetcode #leetcode #python

ความคิดเห็น • 67

  • @tusharmore3860
    @tusharmore3860 3 หลายเดือนก่อน +59

    Learning dsa from neetcode pro and experiencing this... Thank you for the brilliant courses!

  • @yyyd6559
    @yyyd6559 3 หลายเดือนก่อน +30

    def search(target, array):
    left = 0
    right = len(array)
    while left < right:
    mid = left + (right - left) // 2
    if target < array[mid]:
    right = mid - 1
    elif target > array[mid]:
    left = mid + 1
    else:
    return array[mid]
    print(search(6, [1,2,3,4,5,6] ))

    • @asagiai4965
      @asagiai4965 3 หลายเดือนก่อน +1

      You forgot to floor or ceiling. (In some pl)

    • @asagiai4965
      @asagiai4965 3 หลายเดือนก่อน +1

      Also I think the index or a boolean should be the return?

    • @asagiai4965
      @asagiai4965 3 หลายเดือนก่อน

      @@sgetti4dinner I think this gonna have an error already. Btw why do you call it left most binary search? Isn't binary search both left and right

    • @asagiai4965
      @asagiai4965 3 หลายเดือนก่อน +1

      @@sgetti4dinner there is still something wrong with your code. I'm getting none (for some numbers). try to check your code again.
      btw if you want to call your function "first occurence" or anything I think you should just call it that way. Instead of calling it BNS. Because it might confuse other developers using your function. Just an opinion.

    • @sgetti4dinner
      @sgetti4dinner 3 หลายเดือนก่อน

      @@asagiai4965 what example are you getting None? Works for me. Also, I believe the binary search algorithm can be applied to any sequence that has monotonicity. Which can be explained as, at a certain point in our search space all elements before a target element do not satisfy the given condition, and all a elements after the target element do satisfy the condition. This is algo does still use binary search, returns the first occurrence of target and it can return the insertion index of a number that is not in the search space.
      You should still use the first algo if you need, but you’ll find the left most algo more practical in a lot of problems.

  • @rdubb77
    @rdubb77 2 หลายเดือนก่อน +58

    All the haters: yeah it sucks that interviews use leetcode style questions, and being good at them in certain ways is a “flex”, but this guy obviously loves solving them and teaching others.

    • @realnapster1522
      @realnapster1522 หลายเดือนก่อน +5

      Thats his skill set and he is good at it. But why others are being punished?

  • @davidgillies620
    @davidgillies620 3 หลายเดือนก่อน +193

    Of course actual experienced programmers won't have implemented a binary search algorithm in 20 years, anymore than they'd write their own quicksort function.

    • @artificiyal
      @artificiyal 3 หลายเดือนก่อน +12

      dsa is a distraction

    • @randomvidsyt671
      @randomvidsyt671 2 หลายเดือนก่อน +16

      ​@@artificiyalbro dont be a douche...mastering DSA still gives you an advantage at work

    • @realnapster1522
      @realnapster1522 หลายเดือนก่อน +11

      Exactly. If you write any of these algorithms from scratch at work, you would be shown the door.

    • @KSG203
      @KSG203 หลายเดือนก่อน +1

      @@artificiyal cope

  • @Alopez1218
    @Alopez1218 3 หลายเดือนก่อน +73

    As a professional Full stack Software Engineer I have never needed to use any of these.

    • @FirstnameLastname-cl4op
      @FirstnameLastname-cl4op 3 หลายเดือนก่อน +5

      Same

    • @Hilasterion
      @Hilasterion 3 หลายเดือนก่อน +30

      but the libraries and technologies that you use in your day to day job do.

    • @jamescraft5300
      @jamescraft5300 2 หลายเดือนก่อน +6

      thats because web dev doesnt use binary search most

    • @worldspam5682
      @worldspam5682 หลายเดือนก่อน +9

      nowdays "Full stack Software Engineer" is just a web dev

    • @ShinAkuma
      @ShinAkuma หลายเดือนก่อน +8

      As a Web Dev you don't need deep DSA knowledge.
      When a programmer is designing systems that other "Full stack software engineers" will be using, that's where DSA comes into practice.
      Try creating a simple notepad with undo and redo functionality. Let me know how it goes for you.

  • @aaronl8443
    @aaronl8443 14 วันที่ผ่านมา +1

    thanks for sharing great experience. I still feel hard even after school...

  • @davea136
    @davea136 3 หลายเดือนก่อน +6

    You can improve your understanding of Binary Search by trying an implementation and rejecting the half of it that is superfluous, repeat.

    • @akshitrajputhere
      @akshitrajputhere 2 หลายเดือนก่อน

      can you explain more please

    • @fr5229
      @fr5229 25 วันที่ผ่านมา

      @@akshitrajputhereit’s too high IQ of a comment

  • @mohammedinnat8995
    @mohammedinnat8995 3 หลายเดือนก่อน +8

    What is your thought on interview process for specific job? For example, in ML eng or Data science role, company still conduct leetcode or codality problem. I am not explaining more in setails, but I think you get my point.

    • @StarryNightSky587
      @StarryNightSky587 3 หลายเดือนก่อน +2

      Why would they waste time on leetcode when they can grill you on ML theory/statistics etc

  • @ssuriset
    @ssuriset 3 หลายเดือนก่อน +4

    Thanks for the motivation homes

  • @sophiophile
    @sophiophile 3 หลายเดือนก่อน +3

    I think this may not be true for all the variants of DFS (although true for BFS) and all the ways a problem can require you to customize it. For recursion, the weird ass ways that recursion calls propagate info back up for pre/in/post-order depending on the q vary a lot more than Binary, BFS and sliding window. If you go with iterative DFS maybe, but the code patterns for 1 of the traversal patterns in particular make for an awful experience in a code interview when you are supposed to manually walk through multiple examples by hand/with no active code interpreter.

  • @polycoder
    @polycoder 4 วันที่ผ่านมา

    You are just great

  • @aminbusiness3139
    @aminbusiness3139 3 หลายเดือนก่อน +3

    Practice makes permanent

  • @_ShouravChy
    @_ShouravChy 14 วันที่ผ่านมา

    make a video on "When to use hashmap!!The intuition"

  • @logeshkumarrajkumar861
    @logeshkumarrajkumar861 16 วันที่ผ่านมา

    Just as a musician needs to master the basic scales and chords before they can compose complex pieces, a programmer must have fundamental concepts like binary search, DFS, and BFS ingrained in their mind. These basics become second nature and allow them to tackle more advanced challenges effortlessly. I think that’s what he meant. Yes I am stating the obvious 😅 but some of the comments below made me do so

  • @sreehithathatwadi5210
    @sreehithathatwadi5210 3 หลายเดือนก่อน

    Great! Need more videos from you.

  • @asagiai4965
    @asagiai4965 3 หลายเดือนก่อน

    Yes, I think practice makes perfect. Though idk if being fast may have or might not have something to being good.
    I think if you can average 5 mins or less implementing an algo. Then you are good enough for me.

  • @Montu96
    @Montu96 14 วันที่ผ่านมา

    DSA interviews have no basis in the Real Economy, unless you are working in some R&D department at a University, or Government Organization trying to come up with the next best Algorithm & Data Structure for Big Data or something

  • @NitishKumarModi
    @NitishKumarModi 3 หลายเดือนก่อน +2

    We need more of these type of video please

  • @akashgudigar807
    @akashgudigar807 28 วันที่ผ่านมา

    Is there a full video of this?

  • @shad9979
    @shad9979 3 หลายเดือนก่อน

    True

  • @abdullahqureshi7165
    @abdullahqureshi7165 18 วันที่ผ่านมา

    i just learned binary search and now learning interpollation search
    i dont understand the probe formula😵‍💫

  • @code2compass
    @code2compass 3 หลายเดือนก่อน

    Please share your video recording workflow

  • @dossymzhankudaibergenov8193
    @dossymzhankudaibergenov8193 3 หลายเดือนก่อน

    for me binary search harder than others

  • @LeetHaxington
    @LeetHaxington 12 วันที่ผ่านมา

    The first time you run a mile it’s slow like 6 minutes. If you’re a garbage fat lazy person I guess. But then every time you run a mile after that your time actually halves based on this arbitrary graph I made. Now you can run a mile in one second.
    That’s why I have my interviewers run a mile in less than 10 seconds. Massive wiggle room. It’s so easy and do able.
    Literally anyone can do this. I can do it so anybody can. And that means it’s right and the best way to interview candidates.

    • @kylejohnson8447
      @kylejohnson8447 7 วันที่ผ่านมา

      What are you even rambling about

  • @TheViperZed
    @TheViperZed 3 หลายเดือนก่อน

    So let's actually look at reality. If you have problems with binary search reconsider whether programming is for you. Now onto what your actual answer in an interview should be: In cases where binary search would actually yield an improvement it fails because of the way it's going to produce cache misses due to accesses to the heap that are unpredictable by modern cpus.

    • @fr5229
      @fr5229 25 วันที่ผ่านมา

      Nope

  • @yahi06
    @yahi06 3 หลายเดือนก่อน

    this how dev mesure there tree they know is useless but they know there is handshake is my tree bigger than yours.

  • @realnapster1522
    @realnapster1522 หลายเดือนก่อน +1

    Leetcode sucks and interview process is broken!

  • @geoffreyjohnston4047
    @geoffreyjohnston4047 3 หลายเดือนก่อน +1

    i feel like all this is fundamentally wrong. i shouldnt be "practicing" binary search. i should learn collection libraries and understand what type operations i need for problems and then use the library that already has it implemented.

    • @realnapster1522
      @realnapster1522 หลายเดือนก่อน

      Exactly. It’s ridiculous that companies ask these toy problems while you have been working on something much bigger in scope.

  • @jakeanderson4426
    @jakeanderson4426 3 หลายเดือนก่อน +10

    Here come the wave of tech bros copying Pirate Software because they think that’s how the internet works

    • @NeetCodeIO
      @NeetCodeIO  3 หลายเดือนก่อน +25

      ive been making whiteboard videos for 4 years but ok

    • @Dick-xp4hc
      @Dick-xp4hc 3 หลายเดือนก่อน

      Please stop comparing Neetcocde to nepotism baby Piratesoftware!
      At least, Neetcode works really hard to get into those Faang companies not like Piratesoftware who used to works in his daddy companie. He does not have a CS degree but a bug degree!
      Some of us don't have parents work in big tech 😑

    • @Dick-xp4hc
      @Dick-xp4hc 3 หลายเดือนก่อน

      Please stop comparing Neetcocde to nepotism baby Piratesoftware!
      At least, Neetcode works really hard to get into those Faang companies not like Piratesoftware who used to works in his daddy companie. He does not have a CS degree but a bug 🐛 degree!
      Some of us don't have parents work in big tech 😑

    • @Dick-xp4hc
      @Dick-xp4hc 3 หลายเดือนก่อน

      Piratesoftware is a nepo baby bro!

    • @techtutorvideos
      @techtutorvideos 3 หลายเดือนก่อน +2

      I'm confused lmao

  • @landonmoss4208
    @landonmoss4208 3 หลายเดือนก่อน

    False

    • @rm_rf
      @rm_rf 2 หลายเดือนก่อน

      Not False

    • @ssuriset
      @ssuriset หลายเดือนก่อน

      your mom is False

    • @KSG203
      @KSG203 หลายเดือนก่อน

      cope

  • @TheUndulyNoted
    @TheUndulyNoted 27 วันที่ผ่านมา

    I’ve been studying binary search for 2 days now, but I still feel like I lack a “deep” understanding. Sure I can write the algo any way you want, recursively, using loop with Len, using loop with Len - 1, but still feel like I need to go deeper. Maybe I’m just stupid.