Solve This Coding Problem and Win $200

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 2.3K

  • @godofpro5767
    @godofpro5767 3 ปีที่แล้ว +20996

    a real programmer won’t go outside

    • @RedStone576
      @RedStone576 3 ปีที่แล้ว +296

      based

    • @Sp4wn_
      @Sp4wn_ 3 ปีที่แล้ว +151

      based

    • @tedlopez1368
      @tedlopez1368 3 ปีที่แล้ว +119

      based

    • @MrBruh-xc1qy
      @MrBruh-xc1qy 3 ปีที่แล้ว +109

      based

    • @SolathPrime
      @SolathPrime 3 ปีที่แล้ว +72

      I'll rune the joke
      Also your right

  • @secabrepheox5450
    @secabrepheox5450 3 ปีที่แล้ว +4370

    6:11 "It's never too early to start coding"..
    I've been telling my 3 year old kid that but she insists on learning how to read first... Kids these days..

    • @kingbrianmendes
      @kingbrianmendes 3 ปีที่แล้ว +30

      hahaha

    • @punu3675
      @punu3675 3 ปีที่แล้ว +88

      so lazy…

    • @justarandomguy1541
      @justarandomguy1541 3 ปีที่แล้ว +11

      Lol

    • @notcrispeeweevile1388
      @notcrispeeweevile1388 3 ปีที่แล้ว +90

      Yea like really they should stop being lazy. I had already graduated by the time I was 3.

    • @nardalis4832
      @nardalis4832 3 ปีที่แล้ว +4

      You kinda need to read first in order to understand coding :P
      (and yes I know this is most likely a joke lel)

  • @danielgeorgianni1687
    @danielgeorgianni1687 3 ปีที่แล้ว +2500

    "In java it doesnt work"
    Man rethought his existence in .5 second 🤣🤣

    • @ericjohn2352
      @ericjohn2352 3 ปีที่แล้ว +82

      Hahaha "Why am I here, What purpose do I have"

    • @putramakatita8814
      @putramakatita8814 3 ปีที่แล้ว +19

      Hey! 🤣

    • @dgh25
      @dgh25 3 ปีที่แล้ว +10

      i did this in java in 5 mins

    • @Omar-kl3xp
      @Omar-kl3xp 3 ปีที่แล้ว +14

      In Java it would be easy for me to do it however I don’t knw any other programming language yet

    • @iamgroot1328
      @iamgroot1328 3 ปีที่แล้ว +1

      I know python the easiest one

  • @Bayers2020
    @Bayers2020 2 ปีที่แล้ว +555

    The guy at the end said
    “I think it’s an essential skill everyone should have.”
    I cannot agree more.
    I’ve discounted myself for years as dumb or not learned because I’ve never delved into things like this which have always put me in awe and today I realized, when time applied, I could actually do this if I wanted to, and how far progressed would we be technologically if everyone had this under their belt from a young age xD

    • @sudonim116
      @sudonim116 2 ปีที่แล้ว +31

      Issue is not everyone enjoys it

    • @mtutoriales
      @mtutoriales 2 ปีที่แล้ว +10

      So is math yet so many people hate it with passion regardless of their potential.

    • @TheAnimeist
      @TheAnimeist 2 ปีที่แล้ว +3

      I feel the same way about boards. Everyone should at least skateboard, surf, Onewheel, etc. Progress toward peace and no hunger, imagine it xD

    • @angelsaucedo2231
      @angelsaucedo2231 2 ปีที่แล้ว +1

      bruh nothing is hard if you apply yourself. Its just memorizing things. Like advanced maths. Just some people dont care to learn

    • @uku4171
      @uku4171 2 ปีที่แล้ว +5

      @@mtutoriales I think it mostly depends on the teacher. It's also because of the reputation that maths has as "the hard subject".

  • @emachine003
    @emachine003 2 ปีที่แล้ว +100

    The funny thing about 0:52 is that her solution of using reversed() is actually far more efficient than manually writing out a function to reverse the string since Python library functions are highly optimized.

    • @meelaud2103
      @meelaud2103 2 ปีที่แล้ว +38

      no shit XDDD thats y she couldnt use it

    • @MiddleEasternChristian
      @MiddleEasternChristian 2 ปีที่แล้ว +7

      You're right, Since Python is written in C, the library functions are super fast.

    • @bronzejourney5784
      @bronzejourney5784 ปีที่แล้ว +25

      @@meelaud2103 But thats not a right mindset to be a programmer with, especially in today's market. What looks like cheating to you is just another tuesday for us. It just works like that, as said "You dont need to reinvent the wheel everytime you need to go somewhere with your car".

    • @joaofernandes6419
      @joaofernandes6419 ปีที่แล้ว +1

      Recursivity always calling the function + char of the current position until the length of the string would work well too

    • @trash_in_a_box
      @trash_in_a_box ปีที่แล้ว +2

      @@bronzejourney5784 She wasn't the one making up the rules. And honestly, there is a lot to be learned by trying to accomplish something in as many different ways as possible, rather than calling it good with the "easy" or "correct" way.

  • @stxnw
    @stxnw 3 ปีที่แล้ว +7614

    i am starting to think im better than the average programmer after watching this. might be a sampling bias since better programmers dont leave the house.

    • @soruzein2988
      @soruzein2988 3 ปีที่แล้ว +155

      they fear to the sun

    • @stxnw
      @stxnw 3 ปีที่แล้ว +114

      just want everybody to know that i am all green on my github

    • @mohitsagar9492
      @mohitsagar9492 3 ปีที่แล้ว +89

      lol I cringed hard when I saw the first girl using "+=" with a string in Python (since strings are immutable in Python, it basically creates a new string every time making the complexity O(N^2)).

    • @stxnw
      @stxnw 3 ปีที่แล้ว +72

      @@mohitsagar9492 if im not wrong string concatenation are ammortized O(1) just like push_back() in C++ without reserve(). either way, it should be a non issue nowadays. there were more... pressing mistakes.. in the video.

    • @mohitsagar9492
      @mohitsagar9492 3 ปีที่แล้ว +37

      @@stxnw Right in C++ strings are mutable! However in Python and Java they are immutable. Honestly everyone other than the first girl and that one Indian dude with Hashmaps didn't seem to be actual programmers so I didn't expect much from them anyway XD. And you will be surprised how much these small optimizations can matter when dealing with massive data!

  • @clucl3
    @clucl3 3 ปีที่แล้ว +4086

    When grandpa comes out swinging like, "binary, assembly, matlab, basic, that's what I used to use when I was a kid"

    • @sodiboo
      @sodiboo 3 ปีที่แล้ว +76

      cosmic rays

    • @justapugontheinternet
      @justapugontheinternet 3 ปีที่แล้ว +140

      Cobol, fortran

    • @essaquadry
      @essaquadry 3 ปีที่แล้ว +172

      Matlab is still used by Engineers

    • @markushandel5424
      @markushandel5424 3 ปีที่แล้ว +29

      @@essaquadry true and mathematics

    • @kwzu
      @kwzu 3 ปีที่แล้ว +3

      @@sodiboo butterflies

  • @Zordiak
    @Zordiak 3 ปีที่แล้ว +458

    "What language do you program in?"
    Old guy: Punch cards

    • @kennygunderman
      @kennygunderman  3 ปีที่แล้ว +28

      Lmao

    • @ingiford175
      @ingiford175 2 ปีที่แล้ว +31

      Remember doing my final exam for Cobal on punch cards. Program was due before the 2 hour final (2 week assignment). The final exam, he took all our programs, and dropped them on the floor and told us to reassemble our program.

    • @delaseadom6800
      @delaseadom6800 2 ปีที่แล้ว +4

      I'm crying😭😭😭🤣🤣🤣🤣🤣

    • @piaoyugexia
      @piaoyugexia 2 ปีที่แล้ว

      @@ingiford175 EEP!

    • @ashwin-7777
      @ashwin-7777 2 ปีที่แล้ว

      🤣

  • @qmance8062
    @qmance8062 2 ปีที่แล้ว +97

    I watched this video for the first time a year ago. I had no idea what they were even talking about. Now a year later, i know exactly whats going on and im able to solve pretty much every problem. It feels nice to see progress.

    • @Itsmebieno
      @Itsmebieno 2 ปีที่แล้ว

      I want to do so

    • @Gupatik
      @Gupatik ปีที่แล้ว

      same here

    • @BucketListMo
      @BucketListMo ปีที่แล้ว

      Woah for real? What helped you achieve that

    • @filyboy7
      @filyboy7 ปีที่แล้ว +1

      same here! i'm on day 20 of angela yu's 100 days of code on udemy, and i was able to solve every question in the video 😁

    • @Broketechbro
      @Broketechbro ปีที่แล้ว +1

      @@filyboy7I am also studying that course 😊

  • @kaiacrisp
    @kaiacrisp 2 ปีที่แล้ว +151

    Dude I watched this like 6 months ago and didn't know how they did any of this but after taking a CS class in Python I understand it now. Thats insane...

    • @momenmohamed8337
      @momenmohamed8337 2 ปีที่แล้ว +2

      in what U toke it

    • @IllIIIIIIllll
      @IllIIIIIIllll 2 ปีที่แล้ว +6

      same here,that hits different

    • @kaiacrisp
      @kaiacrisp 2 ปีที่แล้ว +1

      @@momenmohamed8337 in a intro to CS college class

    • @vanci2039
      @vanci2039 2 ปีที่แล้ว +1

      If a online class drop the link

    • @dv5625
      @dv5625 2 ปีที่แล้ว

      @@vanci2039 th-cam.com/video/JP7ITIXGpHk/w-d-xo.html

  • @elephantwaffle5612
    @elephantwaffle5612 3 ปีที่แล้ว +1787

    I nervously watched and attempted the problems being a recent Computer Science graduate (thinking that I wouldn't know and would feel stupid). I learned that I can at least answer simple coding problems! Thanks 4 years of college!

    • @nickfleming3719
      @nickfleming3719 3 ปีที่แล้ว +47

      Yeah but, you spent 4 years and $40,000+ to learn what anybody can learn for free on TH-cam in a couple months.
      And in another 4 years, everything you did learn will be obsolete, but you'll still be paying for it.

    • @elephantwaffle5612
      @elephantwaffle5612 3 ปีที่แล้ว +50

      @@nickfleming3719 instate public college + athletic scholarships + academic scholarships + college isn’t really all about what you learn in your courses + computer science isn’t just being good a programming + L + ur white

    • @lva98
      @lva98 3 ปีที่แล้ว +148

      @@nickfleming3719 Computer Science is not about programming or been a programmer

    • @nickfleming3719
      @nickfleming3719 3 ปีที่แล้ว +9

      @@elephantwaffle5612 ok I see why you needed it

    • @elephantwaffle5612
      @elephantwaffle5612 3 ปีที่แล้ว +235

      @@nickfleming3719 imagine watching a few “how to code” vids on TH-cam and then feeling superior enough to make fun of someone for getting a BS in computer science

  • @Quimerateck
    @Quimerateck 3 ปีที่แล้ว +303

    after finishing a course in python programing, i feel prepared to write my print('hello world')

    • @SlugSage
      @SlugSage 3 ปีที่แล้ว +13

      💪🏿

    • @faevourite
      @faevourite 3 ปีที่แล้ว +3

      YES.

    • @LifeOfJowl
      @LifeOfJowl 3 ปีที่แล้ว +1

      Indeed

    • @drownmeinreverb
      @drownmeinreverb 3 ปีที่แล้ว +38

      After taking an advanced python course, i feel prepared to write:
      def main():
      print("hello world")
      if __name__ == "__main__":
      main()

    • @smallypuppy22
      @smallypuppy22 3 ปีที่แล้ว

      Same here

  • @NickWhite
    @NickWhite 3 ปีที่แล้ว +3176

    i think we might be giving money to people that don't really need it...

  • @brownbearedurardo
    @brownbearedurardo 2 ปีที่แล้ว +13

    I'm a 3rd-year Computer Engineering student and this video makes me wanna refresh my knowledge in programming (both C and C++). Love from the Philippines.

  • @ivandumancic2938
    @ivandumancic2938 2 ปีที่แล้ว +12

    Q: name 4 programming languages.
    Guy at 3:45
    A: java (0), python (1), javascript (2), c (3), ruby (4)

  • @Sad-Lemon
    @Sad-Lemon 3 ปีที่แล้ว +495

    An idea: After each question you show the optimal solution and why is it optimal.
    I interviewed like dozens of programmers and one thing to learn as an interviewer - help the programmer to know what mistake he/she made. We don't want to keep people doing the same errors over and over again. This is counterproductive for the industry.

    • @arkesh110
      @arkesh110 ปีที่แล้ว +2

      Yeah for the last one, I thought the solution would just be to use a double for loop and an if statement to find the sum of all the combinations and then just return whatever is at those indexes

    • @bobfarker4001
      @bobfarker4001 ปีที่แล้ว +1

      I feel that way too, but you're asking people on the spot in the street. Without an ide I can't weed out the syntax errors.

    • @asurakk
      @asurakk ปีที่แล้ว

      @@arkesh110 double for loop is too slow you can do it using 1 and having a set to keep track of the elements you found already

    • @MyAmazingUsername
      @MyAmazingUsername ปีที่แล้ว +4

      5:40 He has some typos and syntax errors but the overall concept is great. It makes a dict map of "which remainder maps to the current number". And as soon as it encounters that remainder as a unique number, the dict returns the complementary number that sums with it. Good job coming up with that on the spot.

    • @bobfarker4001
      @bobfarker4001 ปีที่แล้ว

      @@MyAmazingUsername shut up. You're just rehashing what I said with a positive spin.

  • @Landon_Hughes
    @Landon_Hughes 3 ปีที่แล้ว +611

    3:37 didn't know "C+" was a programming language 🤔

    • @Spero_Hawk
      @Spero_Hawk 3 ปีที่แล้ว +122

      It came around the same time as C Flat.

    • @mesh3218
      @mesh3218 3 ปีที่แล้ว +46

      The son of c++ is c+😀😀😀😀😀😀

    • @mariop4211
      @mariop4211 3 ปีที่แล้ว +40

      Lol that’s me! I panicked

    • @atti1120
      @atti1120 3 ปีที่แล้ว +25

      Family with C hashtag

    • @user-tk2jy8xr8b
      @user-tk2jy8xr8b 3 ปีที่แล้ว +35

      Maybe he designed it himself, you can never be sure

  • @uyscuti5571
    @uyscuti5571 3 ปีที่แล้ว +44

    man at 3:37 is like : C , C# ,C+,C++,C+++,C x max pro ,C lite

  • @pomodoro3478
    @pomodoro3478 2 ปีที่แล้ว +4

    5:20 this challenge can be solve just by using 2 indexes and a for loop to scan the array 1 time since it's ordered

    • @maniakos_
      @maniakos_ 2 ปีที่แล้ว +2

      You can do it with one index as well

  • @ab.5
    @ab.5 2 ปีที่แล้ว +16

    grandpa still remembers Fortran 💀 3:25

  • @arpanghoshal2579
    @arpanghoshal2579 3 ปีที่แล้ว +31

    2:06 Does it matter what language?
    Nah
    *Processed to write machine code in 0s and 1s*

  • @KhainiSader
    @KhainiSader 3 ปีที่แล้ว +492

    would've have been more interesting, if you asked them to just walk it through instead of writing code. This way you can find people who have no clue of coding but have natural design/engineering skills. This would also require you to re-arrange the question for better understanding. Cool :D

    • @WoWkiddymage
      @WoWkiddymage 3 ปีที่แล้ว +64

      That's kinda hard if you don't really understand the basic ruleset that programming provides (ways data/variables are stored, and ways to compare them). But I also think it would be a really good idea.

    • @mk177
      @mk177 3 ปีที่แล้ว +5

      if you don't know anything about coding and the language they cannot test for anything imho obv. analogy here but would a racecardriver prove his talent if he hasn't touched go-karts at a young age. I have been good at math all my life, went up to AP Calc/Passed, but first time I saw a for loop iteration I was astounded, maybe makes it easier to understand after you have seen it but most of coding algos and components making them are kind of like magic tricks, you will need practice (alot) to understand how they are done. My .02

    • @minhuang8848
      @minhuang8848 3 ปีที่แล้ว +3

      @@WoWkiddymage But that's the point, everyone does coding. Everyone who has learned how to manually calculate the root of a given number is pretty much primed to code in their heads, programming is just an abstraction layer to offload strict calculations while the programmer conceptualizes the steps. And yeah, definitely a dope idea, anything to get people involved who didn't think they were suited for it. Maybe some kind of paid bootcamp next where people just get money for learning a basic curriculum, that'd be fun too.

    • @WoWkiddymage
      @WoWkiddymage 3 ปีที่แล้ว +8

      @@minhuang8848 What I'm saying is that these algorithm-based questions are created with restraints that you only understand if you have programmed before. Yes, coding/programming is "just" an abstraction but that is often the difficult part about it. Putting these concepts into the limits of programming data structures and being restricted by time complexities. I think the general idea of pattern recognition/problem solving that is similar to the coding question would create a cool sort of puzzle, but then that would be a totally different type of analysis of the problem if you don't include the ruleset that programming provides. You would basically have to teach someone all the basics of programming to see if they understand how to fit a problem into the constraints that programming provides.

    • @WoWkiddymage
      @WoWkiddymage 3 ปีที่แล้ว +2

      Also, I'm not saying it wouldn't be a good idea. I think it would be really cool to tickle people's brains on the subject. I just think that the implementation of this kind of "social experiment" would be quite difficult, it would cost a lot of effort on the participants not previously understanding the limitations. Who knows though, there might be some cool ways to implement this idea...

  • @rbt-0007
    @rbt-0007 3 ปีที่แล้ว +173

    Wish I was there, literally free money for every single question.

    • @kennygunderman
      @kennygunderman  3 ปีที่แล้ว +19

      Next time

    • @omairkhaled1709
      @omairkhaled1709 3 ปีที่แล้ว +5

      Literally man 😂😂😂

    • @rachitjasoria9041
      @rachitjasoria9041 3 ปีที่แล้ว +4

      seriously bro way to easy ques

    • @Nagim-d3z
      @Nagim-d3z 2 ปีที่แล้ว

      Yeah literally 10 kyu on CodeWars

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

      skillshare is a scam beware search the topic in yt u'd know btw i teach python and c too in hindi.

  • @MyAmazingUsername
    @MyAmazingUsername ปีที่แล้ว +15

    5:40 He has some typos and syntax errors but the overall concept is great. It makes a dict map of "which remainder maps to the current number". And as soon as it encounters that remainder as a unique number, the dict returns the complementary number that sums with it. Good job coming up with that on the spot.

    • @TUMATATAN
      @TUMATATAN ปีที่แล้ว +3

      Honestly, he overcomplicated that. He had the right idea but then went rogue with the syntax and that code is definitely not maintainable. lol

  • @aliahmed-vd2nt
    @aliahmed-vd2nt 2 ปีที่แล้ว +4

    for reversing a string simply use slicing
    string="Ali"
    print(string[::-1])

    • @lia_64
      @lia_64 2 ปีที่แล้ว

      That's what i was thinking

  • @sketchturner6669
    @sketchturner6669 3 ปีที่แล้ว +8

    5:35 my nigga even doin the exception handling

  • @MUHAMMADIBRAHIM-gd1xp
    @MUHAMMADIBRAHIM-gd1xp 3 ปีที่แล้ว +71

    That's quite interesting, first of it kind that i have seen.... But you or the person solving it should always walk through the code so that we will learn too

    • @quanganhbui9503
      @quanganhbui9503 3 ปีที่แล้ว

      Yesn’t

    • @ferociousfeind8538
      @ferociousfeind8538 2 ปีที่แล้ว +1

      It's always important to make sure the answerer knows how it works, or at least gives an answer that, if the written code doesn't quite do it, does justify the thought process, and checks out.

  • @djaberomarkahlouche6342
    @djaberomarkahlouche6342 3 ปีที่แล้ว +66

    this's a great video , at least you motivate some people to learn coding and don't see coding is a impossible mission. Great video , keep going

    • @samanmehralipoor9773
      @samanmehralipoor9773 2 ปีที่แล้ว +2

      programming languages are easy to learn but becoming a professional developer is not.
      so I think it's not ok to say everyone "come on start to learning programming".

  • @jakeleo4518
    @jakeleo4518 2 ปีที่แล้ว +1

    The ultimate indian friend group 4:46 this would be talked about in the friend group for weeks if you can slove it in front of them.

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

    I’ve written a 12,000-line Python thingy that works and solves a massive problem. I have no idea how to approach most of that in the video. Not sure why there’s such a focus on math and data stuff. You don’t need to know the mega-geeky stuff to be useful.

  • @supriyosarkar5132
    @supriyosarkar5132 3 ปีที่แล้ว +273

    To the first girl, who solved the reverse string problem : Nick just forbade you to use inbuilt functions, not inbuilt operators.
    Simply - string[::-1]

    • @googleuser4203
      @googleuser4203 3 ปีที่แล้ว +47

      It is more of a solving the problem mathematically with basic tools rather than how much do you know about the language itself.

    • @manankumar3983
      @manankumar3983 3 ปีที่แล้ว +3

      op bro . i also thought the same

    • @carsnnn5018
      @carsnnn5018 3 ปีที่แล้ว +3

      Literally posted a comment about that before seeing this one lol

    • @cgme7076
      @cgme7076 3 ปีที่แล้ว +2

      I immediately yelled “LIST COMPREHENSION”

    • @droidgenetx
      @droidgenetx 3 ปีที่แล้ว +3

      noice.

  • @kyuss789
    @kyuss789 3 ปีที่แล้ว +241

    Super interesting watching people solve this stuff. Every question I was like “oh yeah just do this” then they come up with something completely different.
    $200 dollar guy threw me right off

    • @JordanMetroidManiac
      @JordanMetroidManiac 2 ปีที่แล้ว +42

      He found an O(n) solution, iterating over the array exactly three times to determine a solution if any exist, when the naïve solution is O(n^2), using nested loops. I didn’t see the hashmap solution lol. He deserves the $200.

    • @quasii7
      @quasii7 2 ปีที่แล้ว +3

      But he made a small mistake. In Python list object doesn't have any attribute called length, len(arr) would have been correct instead

    • @JordanMetroidManiac
      @JordanMetroidManiac 2 ปีที่แล้ว +32

      @@quasii7 Yeah. He had the right idea though and definitely could have debugged it given the chance.

    • @RandomVideos-yz5qf
      @RandomVideos-yz5qf 2 ปีที่แล้ว

      @@JordanMetroidManiac He had the right idea with the subtraction and then finding the other value within the remainder of the array, not sure why he overcomplicated it by using the hashmap as his first attempt. Interesting to see regardless.

    • @sidharth8007
      @sidharth8007 2 ปีที่แล้ว +1

      @@RandomVideos-yz5qf That's a O(N^2) solution though since you need two for loops. The way he did it (storing using a dictionary), you can do it in a single loop O(N) solution.

  • @MrNsaysHi
    @MrNsaysHi 3 ปีที่แล้ว +27

    competitive programmers:
    “are you insulating our traditions?”

  • @Taterzz
    @Taterzz 2 ปีที่แล้ว +3

    if there's anything i learned from my astronomy degree, it's that everything can be solved with for loops.

  • @memorializers
    @memorializers ปีที่แล้ว +11

    You can optimize the very first code by just doing this in python:
    *string = str(input("Input Your String: "))*
    *print(string[::-1])*

    • @matheustran8009
      @matheustran8009 ปีที่แล้ว

      return input(“your string: “)[::-1]
      input() already returns a string, no need to turn it into a string again

  • @syedayaanhussain6151
    @syedayaanhussain6151 3 ปีที่แล้ว +35

    Q1-
    #reversing a string in 2 lines
    inputstr=input("Enter the string here")
    print(inputstr[::-1])

    • @halbgefressen9768
      @halbgefressen9768 3 ปีที่แล้ว +15

      #imaprogrammerandneedtotelleveryone

    • @Mariiius53
      @Mariiius53 3 ปีที่แล้ว

      What language is that ? I never saw " ::- " operator wow

    • @syedayaanhussain6151
      @syedayaanhussain6151 3 ปีที่แล้ว

      @@Mariiius53 python and using slicing

    • @Pong-IT
      @Pong-IT 3 ปีที่แล้ว

      echo implode('',array_reverse(str_split($string)));

    • @Mariiius53
      @Mariiius53 3 ปีที่แล้ว +3

      Real programmers make it in brainfuck

  • @DeepakKumar-xr3oh
    @DeepakKumar-xr3oh 3 ปีที่แล้ว +31

    This is something that should be encouraged more. Why would someone dislike this video is beyond my comprehension.

  • @foolwise4703
    @foolwise4703 2 ปีที่แล้ว +1

    Reverse string:
    lambda str: str[::-1]
    2d array sum:
    lambda arr: np.sum(np.array(arr))

  • @Random-ey7tq
    @Random-ey7tq 2 ปีที่แล้ว +4

    THE GOLDEN RULE of coding; if you stuck in a question, just throw a hashmap to it. 90% of the time you'll make at least some progress...

  • @teeraucher
    @teeraucher 3 ปีที่แล้ว +42

    its cool to see that so many people are actually getting in to coding. But still I cant stop myself thinking the whole time: "But that's a one liner?!" xD

  • @PinoyDiskubreChannel
    @PinoyDiskubreChannel 3 ปีที่แล้ว +82

    I thought the First guy - Indian guy would solve the Difficult round first...but SAVE by the SECOND Indian guy! WAY TO GO INDIAN TEACHERS on TH-cam!!!!

    • @NoOne-sy5fg
      @NoOne-sy5fg 2 ปีที่แล้ว +1

      The hashmap guy was making things complex for himself...when it could be solved so simple in O(N) time complexity

    • @ivicamajmunskikreten9714
      @ivicamajmunskikreten9714 2 ปีที่แล้ว

      @@NoOne-sy5fg lol idd, I facepalmed when I heard hashmap.

    • @MattMcConaha
      @MattMcConaha 2 ปีที่แล้ว +1

      @@NoOne-sy5fg I think with a hashmap the problem can be solved in O(N) even if the array isn't sorted. If the array is sorted then you can get O(N) using a more basic method, but I don't think the problem statement specified that the array was necessarily sorted. The hashmap is definitely more complicated in terms of basic operations that would need to be understood, but in code it is all abstracted away and then using the hashmap will end up with cleaner code than the other method that has the same time complexity but only works on a more constrained problem.

  • @ayubhaji2441
    @ayubhaji2441 3 ปีที่แล้ว +33

    That first girl solution was nice, I been around your channel around the past but this is the first time seeing you do these videos. It's been a while since I solve some problems, these videos awake that feeling in me again.😁

  • @mmiselodlephu3669
    @mmiselodlephu3669 2 ปีที่แล้ว +2

    First time I watched this video was before I started coding and I had no idea what's happening. I just returned to see how far I've come. It's unbelievable how far I've come in 5 months

  • @coreyellis3327
    @coreyellis3327 2 ปีที่แล้ว +46

    One day I’ll be a coder and work at a big data company and reply to this video that I made it! Thanks for all this information time to get started on my journey! 💪

    • @Thiago--de6ez
      @Thiago--de6ez 2 ปีที่แล้ว +1

      @Mino Royale fr, to me i'm learning things really quick, might be because i have great willingness to learn.

    • @TheLemonyOne
      @TheLemonyOne 2 ปีที่แล้ว +1

      how goes the journey fellow dev?

    • @Zeeshan_Tanwri
      @Zeeshan_Tanwri ปีที่แล้ว +1

      How is your journey going

    • @coreyellis3327
      @coreyellis3327 ปีที่แล้ว

      @@Zeeshan_Tanwri ChatGPT has made me somewhat an expert. Thank you for checking in. Hope everyone's coding journey is going well :))

  • @GraphicalBoss
    @GraphicalBoss 3 ปีที่แล้ว +93

    This coding videos are awesome! I don't get impressed by much but this is very fun and interesting. Love it. Can't wait to see the next one of this.

  • @Skatinima
    @Skatinima 3 ปีที่แล้ว +31

    I would never thought of using a hashmap and exceptions to solve the last one.
    All that was needed was two pointers, one starting in the beginning and the other at the end, keep checking the sum and move the appropriate pointer if the sum if bigger or smaller than the target.

    • @АлександрСоколов-т2я
      @АлександрСоколов-т2я 3 ปีที่แล้ว +15

      it can be done only on sorted array so complexity is O(nlogn). Using hashmap u have O(n) but also same memory complexity

    • @flavorlessquark8614
      @flavorlessquark8614 2 ปีที่แล้ว +3

      @@АлександрСоколов-т2я I think the leetcode one times you out if you use the naive approach, if he the guy in the video had done it on leetcode he probably remembers doing it that way because that's a way that will get your answer validated

    • @Vikas_Kumar_Singh
      @Vikas_Kumar_Singh 2 ปีที่แล้ว +2

      @@flavorlessquark8614 yep and since its the first code on leetcode I think the average coders might have already solved it since when they teach DSA in courses they try combination sum as the first question to solve usually

    • @flavorlessquark8614
      @flavorlessquark8614 2 ปีที่แล้ว

      @@Vikas_Kumar_Singh I would like to think that most coders, as mysef, are self thaught. It's also a thing to solve it, as it is another to solve it efficiently

    • @ferociousfeind8538
      @ferociousfeind8538 2 ปีที่แล้ว

      The array is sorted?

  • @ahmadmohamad8416
    @ahmadmohamad8416 3 ปีที่แล้ว +16

    2:20 hey heeeeeeeeeey lmao

  • @charlestolley2294
    @charlestolley2294 2 ปีที่แล้ว +1

    "C, C#, C+, C++", can't believe he got away with that

  • @SurfinScientist
    @SurfinScientist 2 ปีที่แล้ว +1

    Hmm, just off the top of my hat I can mention 20 programming languages: Basic, Fortran, Algol60, Algol68, PL/I, Pascal, Lisp, APL, Cobol, Prolog, C, C++. C#, Ada, Java, Javascript, Rust, Julia, Ruby, Python. I guess I'm getting old.

  • @FrontEnded
    @FrontEnded 3 ปีที่แล้ว +5

    27 years old nd just started to code, i love it btw

  • @viepng
    @viepng 2 ปีที่แล้ว +3

    Remember y'all, of you ever get stuck on an interview question, throw a hash map at it

  • @jw1ck
    @jw1ck 3 ปีที่แล้ว +7

    Bro the one kid that goes, “EY” when he says Java doesn’t count 😂

  • @micknamens8659
    @micknamens8659 2 ปีที่แล้ว

    -- sum2d in Haskell with standard Prelude function 'foldl' :
    sum2d = foldl (foldl (+)) 0
    -- outputting the sample result:
    main = putStr $ show $ sum2d [[1, 2, 3],[4, 5]]

  • @eternalheckler
    @eternalheckler 2 ปีที่แล้ว +2

    3:37 We all just gonna pretend that C+ is a programming language?

    • @machekazzo
      @machekazzo ปีที่แล้ว

      After c++: c+++, c++++, c+++++...
      Before c++: c+, c, c-, c--, c---, c----...🤣

  • @K_CO_GurvinderSingh
    @K_CO_GurvinderSingh 3 ปีที่แล้ว +9

    hard part is the complexity or constraints on input data . Thats what makes u apply mathematics

  • @ragtop63
    @ragtop63 3 ปีที่แล้ว +38

    6:09 "Start coding early. It's never too early to start coding."
    Actually, just start coding. It's never too late to start coding either. I'm a photographer in my 40's and I try to learn a new programming or scripting language every year. I'm on my 9th language now.

    • @wiljagerhardt1219
      @wiljagerhardt1219 3 ปีที่แล้ว +14

      9th one but with 10% knowledge each

    • @KingBobbito
      @KingBobbito 3 ปีที่แล้ว +3

      ​@@wiljagerhardt1219 I'm going to agree with this comment, what's the most years you've spent on a single language? While learning a lot of languages may be fun, it's much more useful to be skilled in 2 or 3 than mediocre in 9. Get good with a functional language and an OO language.

    • @ragtop63
      @ragtop63 3 ปีที่แล้ว +4

      @@wiljagerhardt1219 That's an interesting assumption. Entirely false but interesting nonetheless. I can only conclude that the assumption stems from one's own experiences. However, when I choose to learn something, no matter what it is, I fully immerse myself (8+ hours per day, 5 to 6 days per week) for the duration of the time I choose to learn it. And I don't stop learning about said topic when that duration is concluded. I just reduce the amount of time I spend working with said subject to make room for my next endeavor. This doesn't only apply to coding, this also applies to everything I do in life: coding, network engineering, automotive mechanics, dancing, art, photography, video production, cooking, etc.
      I realize this seems like an unrealistic approach to you but that's the difference between people like me and people who are not like me. I also realize some people just aren't capable of doing something like this but for me it's just a simple matter of what level of commitment I am willing to put into something and sticking to it.
      Have a nice day.

    • @ragtop63
      @ragtop63 3 ปีที่แล้ว +2

      @@KingBobbito Unfortunately Wilja, in my case, would be wrong. But I can see why people would be afraid to move beyond their apprehensions.

    • @JW-jd6sn
      @JW-jd6sn 3 ปีที่แล้ว +1

      @@ragtop63 just because you dedicate yourself for a period of time to learning a language doesn't mean you are NOT mediocre, it takes years to become even decent at programming and you need to either create projects or have professional experience. So you saying you are on your 9th language is just silly to be honest, I work with very very smart people who have spent years programming and they are fluent in maybe 4 max. You might know the basics but if someone give you a repo and asked you to understand it you would be lost

  • @anvithkakkera7196
    @anvithkakkera7196 3 ปีที่แล้ว +9

    wow, u went from 30k to almost 80k subs! amazing, didn't realize how much ur channel grew recently

  • @abir95571
    @abir95571 ปีที่แล้ว +2

    Them old dude isn’t messing about .. cobol , fortran 😂

  • @jblen
    @jblen 2 ปีที่แล้ว +1

    As a cs student who did a year in industry last year, learning programming can get you a whole lot more than $100.
    (But a little extra cash is always appreciated, especially for just a few minutes of your time!)

  • @user-uo5id1dd5s
    @user-uo5id1dd5s 3 ปีที่แล้ว +16

    Awesome idea for a video!
    You should make it series I'm sure its gonna give you tons of views
    keep up the good work

  • @emachine003
    @emachine003 2 ปีที่แล้ว +3

    I have a CS exam today, and I'm practicing for the coding problems by going through and doing each problem in Java. Thanks for this video!

    • @johndorian4078
      @johndorian4078 2 ปีที่แล้ว

      if these problems are your practice............................... good luck.

    • @emachine003
      @emachine003 2 ปีที่แล้ว

      @@johndorian4078 took the exam already. It was kind of hard, but not that bad. Honestly, I was more following along for fun than actually preparing for the exam.

  • @Rakeshyadav-ud8di
    @Rakeshyadav-ud8di 3 ปีที่แล้ว +11

    It's great work done by you and for those who are starting career in IT.

  • @bradleyhastings2422
    @bradleyhastings2422 2 ปีที่แล้ว

    The two sum could be done iterating 0

  • @biniteshome1403
    @biniteshome1403 2 ปีที่แล้ว +1

    i like the dude who added error handling, catching errors so they don't hit the ground. epic

  • @digitalmoustache8416
    @digitalmoustache8416 3 ปีที่แล้ว +16

    Sponsored by Skillshare, Udemy getting all the PROMOTION is just hilarious. Thanks Skillshare LOL 😂

  • @patrickgambill9326
    @patrickgambill9326 3 ปีที่แล้ว +5

    The $200 guy had a way more clever solution than I would have

    • @kennygunderman
      @kennygunderman  3 ปีที่แล้ว +5

      Same it kinda threw me off tbh

  • @kennygunderman
    @kennygunderman  3 ปีที่แล้ว +21

    Make sure to check out Nick's video for part 2! th-cam.com/video/WDuZ_S_9vLg/w-d-xo.html

  • @gauravswami6213
    @gauravswami6213 ปีที่แล้ว +2

    100$ for reversing a string 🤣 man I worked on a full fledged website for around 1.5 moths for a hackathon that didn't even pay me that much

  • @DNGR369
    @DNGR369 ปีที่แล้ว +1

    Thanks for creating problems to solve and saving a Street Programmer out in the wild.

  • @lucasgoddamn
    @lucasgoddamn 3 ปีที่แล้ว +4

    4:48 If you have no idea what youre doing, always throw a hash map at it - a wise old programmer once

    • @1dgram
      @1dgram 2 ปีที่แล้ว +1

      He should have used a (hash)set.

    • @1dgram
      @1dgram 2 ปีที่แล้ว

      or if you want to allow duplicate elements (like sum=8 and more than one 4 to appear in the list) a multiset. Yes, that's basically a hash map with the values being the counts.

  • @ahmad.ramadan
    @ahmad.ramadan 2 ปีที่แล้ว +4

    0:25 only programmers would notice the ==

  • @crayder1100
    @crayder1100 3 ปีที่แล้ว +8

    I wanna agree with that fella at the end, programming is an essential skill. People use the skills needed for programming all the time already. But learning programming languages, efficiently writing algorithms, learning how to best store information, etc, all of these surprisingly make thinking and processing information easier for me. I don't know how to explain it.
    Which brings up a good side point, I SUCK at explaining things. But thinking about things in a programming sense helps with that too.

    • @PySnek
      @PySnek 3 ปีที่แล้ว +6

      You also need the skill of plumbing every day to take a shit on your toilet, or the skill of an electrician, to give power to your computer. Today everyones flying, do you also need to know the basics of operating an airbus or boeing airliner? You wear clothes everyday... why don't you learn how to sew and manufacture shoes, pants, jackets? Life's short, people are into different things. Not everyone want's to learn how to code, or how hardware works.
      Most people don't even understand, how a car motor runs, or how we breath with our lungs in detail.
      Do you know, how to help a woman giving birth? This should be an essential skill in my opinion. Nothing's more essential, than the creation of a new human beeing.

    • @mariam6799
      @mariam6799 ปีที่แล้ว

      ​@user-hq4cj6rw7b "Programming is an essential skill".
      "CAN YOU FLY AN AIRBUS HUHH"

    • @mariam6799
      @mariam6799 ปีที่แล้ว

      ​@@PySnekDude, chill out. Programming is a more valuable work than making clothes just from the fact that its used in more than 100 careers for various stuff. If you don't like it, don't learn. But denying it's importance shows how immature you are 😂

  • @Elbasura774
    @Elbasura774 ปีที่แล้ว +1

    if youre interested in a better way for the reversed string (in python):
    def reverse(st):
    result = ''
    for index in range(len(st)):
    result += st[-(index + 1)]
    return result
    all you do is use the regressive index (iterable_variable[-value]) in python to sum each respective character in a loop.

    • @smuggee
      @smuggee ปีที่แล้ว +2

      or even better str = str[::-1]

    • @solaire_of_the_east
      @solaire_of_the_east ปีที่แล้ว +1

      @LambdaSan Bruh, that's what I was thinking. All these people defining function for a simple task.

  • @jinks908
    @jinks908 ปีที่แล้ว +1

    That smile when he said “perfect candidate” to the first girl, we all knew what he really meant lol

  • @acrnm
    @acrnm 2 ปีที่แล้ว +3

    3:00 - that dude is prolly the producer

  • @sonikblade
    @sonikblade 3 ปีที่แล้ว +5

    The C# programmer was cut out of the video in the twosum equals 9 problem, cause Kenny gave him the prize instantly the moment he saw Foreach written in the whiteboard.

    • @sneak9407
      @sneak9407 2 ปีที่แล้ว

      Yep, it's foreach has worse performance than regular for loops. No need to let people see that solution and start considering it a good approach.

    • @sonikblade
      @sonikblade 2 ปีที่แล้ว +1

      @@sneak9407 I garantee you that the whiteboard would not have enough RAM for any of both approaches

    • @sneak9407
      @sneak9407 2 ปีที่แล้ว

      @@sonikblade lmao.

  • @halbgefressen9768
    @halbgefressen9768 3 ปีที่แล้ว +56

    The virgin Java: *needs 8 lines and two loops*
    The chad Haskell: sum2DArray = sum . concat

    • @user-tk2jy8xr8b
      @user-tk2jy8xr8b 3 ปีที่แล้ว +3

      Unless you are using a real 2D Array, then it would be `sum2DArray = sum . elems`

    • @Вікторія3о
      @Вікторія3о 3 ปีที่แล้ว +2

      if .reversed() wasn't good enough for the first problem, then your comment makes no sense

  • @ericjorgearnezinochea9679
    @ericjorgearnezinochea9679 3 ปีที่แล้ว +5

    All of them were pretty easy. Thank you. I still have some imposter syndrome and this helped.

    • @yoshiontheloose
      @yoshiontheloose 2 ปีที่แล้ว +1

      When you have imposter syndrome, think of the robot guy from Grandma's Boy and laugh about that character lol. You're doing great, keep it up and code everyday.

    • @datcate9116
      @datcate9116 2 ปีที่แล้ว

      This is my week 4 of CS and I'm alr stressing that I don't understand any of these lol

    • @billr5842
      @billr5842 2 ปีที่แล้ว

      @@datcate9116 I am in my first hour of CS and I dont understand any of this

    • @datcate9116
      @datcate9116 2 ปีที่แล้ว

      @@billr5842 I'm no longer in CS HAHA

  • @erikmesi27
    @erikmesi27 ปีที่แล้ว

    4:17 problem. The 4:50 solution is O(n)
    But there's an O(log(n)):
    • Sort array using quicksort.
    • Create two integers to store the left and right indices to sum (l and r).
    • while l < r: Sum a[l] and a[r]. If equal to the valué we looking for, return true. Else If greater then r--; else l++;

    • @kNowFixx
      @kNowFixx ปีที่แล้ว

      O(n) is better than O(n log(n)), just so you know

    • @erikmesi27
      @erikmesi27 ปีที่แล้ว

      @@kNowFixx You are right. I made a mistake when writing the initial comment, the algorithm described is O(log n) not O(n log n). I will edit my message to correct it. Thank you very much for your appreciation 😊

  • @sirwee_
    @sirwee_ ปีที่แล้ว +1

    The 2sum guy is my hero, the man hand writes error handling into it for no reason ❤️

  • @ndkshr
    @ndkshr 3 ปีที่แล้ว +28

    It would be really cool if someone just said "A, B, C, D" for the four programming languages.

    • @shashwatpandey3556
      @shashwatpandey3556 3 ปีที่แล้ว

      B, C, D actually exists... 🤣🤣🤣🤣🤣

    • @ndkshr
      @ndkshr 3 ปีที่แล้ว +1

      @@shashwatpandey3556 All of them exist A B C D

    • @shashwatpandey3556
      @shashwatpandey3556 3 ปีที่แล้ว

      @@ndkshr never heard of 'A' though...
      But man this would've been epic... 😂😂😂😂

    • @ndkshr
      @ndkshr 3 ปีที่แล้ว

      @@shashwatpandey3556 A was created by Grace Hopper

    • @shashwatpandey3556
      @shashwatpandey3556 3 ปีที่แล้ว

      @@ndkshr Man share any article if you find I can't find anything, for Grace Hopper, results says he developed COBOL

  • @SubashsVlogs
    @SubashsVlogs 3 ปีที่แล้ว +8

    Real programmers are probably sleeping in their rooms 😂

  • @aryelpanda
    @aryelpanda 3 ปีที่แล้ว +4

    you should zoom even for a second on the code, each time so we can have a look at it.

  • @flamewave000
    @flamewave000 2 ปีที่แล้ว

    First Question: Do you want fast but more memory, or slow but little memory? Fast: Create new string same size as old, iterate in reverse order, assigning each value to the new string. Slow: iterate over the string until the floored half way point, using a intermediary variable, swap the value from the front half with the inversed index of the later half. Flooring the half way point automatically accounts of odd length strings that do not need the middle character swapped.
    Second Question: Do you want a Single For-Loop (fixed length arrays), or a Double For-Loop (variable length arrays)? Single: `arrSize = arr.size ? arr[0].size : 0; count = arrSize * arr.size;` iterate until you reach the end, adding each value along the way with `for(int c=0; c < count; c++) sum += arr[c / arrSize][c % arrSize];`. Or the easier Double which just uses a nested for loop to where the outer for-loop iterates over the first dimension, and the second nested for-loop iterates over the second dimension.
    Third Question: Yeah... I'm fluent in 9 different programming languages. (10 if you think C and C++ are "different" languages lol)
    Fourth Question: Another Slow but less memory O((n-1)!) using double for-loop or fast O(n) but more memory? Use a rolling iterator that breaks when it hits the target. `for(int c = 0; c < arr.size; c++) for(int i = c; i < arr.size; i++) if(arr[c] + arr[i] == sum) return (arr[c], arr[i]); return (-1, -1);` Or you can use a Hash Set (not a Hash Map) which is faster but uses much more memory. Iterate list, adding each element to the set, checking if a value already exists in the set equal to `sum - arr[c]`, returning as soon as it is found. `for(int c = 0; c < arr.size; c++) if(mySet.contains(sum - arr[c])) return (arr[c], sum - arr[c]); mySet.add(arr[c]);`
    **sigh** not sure why I'm writing this so late at night, but I enjoy little coding challenges like these lol.

    • @felix-dk9tr
      @felix-dk9tr 2 ปีที่แล้ว

      C and C++ are obviously completely different languages

    • @flamewave000
      @flamewave000 2 ปีที่แล้ว

      @@felix-dk9tr C++ is just C with more syntax, features, and libraries. If you can write C++, you can also write C. I think it's a subjective opinion on if C++ is technically a different language, or just a more advanced version of C. Which is why you always see them together as "C/C++".

  • @Cl0udWolf
    @Cl0udWolf 2 ปีที่แล้ว

    id love to see someone answer using matlab, most of these r 1 liners
    "doesn't matter what language"
    Matlab:
    1. string{1}(end:-1:1)
    2. sum(Arr,[],'all')
    3. (bit longer) [x = array of ints, t = target]
    for i1 = 1:numel(x)
    i2 = find(x + x(i1) == t)
    if(i2)
    break
    end
    end

  • @rally_furymoments5294
    @rally_furymoments5294 3 ปีที่แล้ว +30

    The guy that won the 200 bucks performs cool programming magic!!!

    • @arracso.
      @arracso. 3 ปีที่แล้ว +5

      He just wanted to give the better solution regarding time consumption O(n) (since hashmap most of the time only takes O(1) to access)

    • @antonfernando8409
      @antonfernando8409 3 ปีที่แล้ว

      @@arracso. what was the solution? didnt' quiet catch it.

    • @arracso.
      @arracso. 3 ปีที่แล้ว +2

      @@antonfernando8409 He is basically addidng to a hashmap (in python dict) the complementary number to the one he is currently in. Also every time he see if the number that he is on is or not on the dict. If it is then he just found the two numbers. (sorry my explanation may not be the best).

    • @arracso.
      @arracso. 3 ปีที่แล้ว +1

      also acces to the dict is O(1) most of the time so instead of O(n^2) he just achieved O(n).

  • @jonathangigi3163
    @jonathangigi3163 3 ปีที่แล้ว +4

    if only the questions in the test were this simple

  • @kennygunderman
    @kennygunderman  3 ปีที่แล้ว +99

    The first 1,000 people to use this link will get a 1 month free trial of Skillshare! skl.sh/kennygunderman07211

    • @7heMech
      @7heMech 3 ปีที่แล้ว +1

      Can't even get it for the lack of card

    • @zeno6336
      @zeno6336 3 ปีที่แล้ว +1

      @@7heMech exactly

    • @NaveenKumar-os8dv
      @NaveenKumar-os8dv 3 ปีที่แล้ว +2

      Thank u very much

    • @gowthamkowshik8815
      @gowthamkowshik8815 3 ปีที่แล้ว +1

      Kind hearted man!
      ☺️

    • @HiHi-ek1dd
      @HiHi-ek1dd 3 ปีที่แล้ว

      Ok

  • @tristanwait4itlegendary
    @tristanwait4itlegendary ปีที่แล้ว +1

    6:08 Yeah but Windows doesn't even ship with VS Code by default so people dont even know that theres free software to code with and how easy it is
    I posted a comment on the feedback hub and since i didnt get anything back
    They should at least have VS code installed by default instead of the bloatware that it comes with

  • @johnshaw6702
    @johnshaw6702 2 ปีที่แล้ว +1

    In most modern languages, the simplest answer is the same. You could write it in C and you've already covered C++, C#, and others. There my be some difference in syntax, but the algorithm is the same.

  • @dj_b1627
    @dj_b1627 3 ปีที่แล้ว +25

    That was insanely entertaining and funny. Please do this again.

  • @fullmetaltheorist
    @fullmetaltheorist 3 ปีที่แล้ว +6

    Me a first year coding student : *"Mhhhh. Yes. I don't understand any of this."*

    • @syedayaanhussain6151
      @syedayaanhussain6151 3 ปีที่แล้ว

      seriously? Lol i am a high school coder and know them

    • @sharde26
      @sharde26 3 ปีที่แล้ว

      You'll get there :)

    • @void6246
      @void6246 3 ปีที่แล้ว +2

      @@syedayaanhussain6151 lol, i am a 4 year old still can solve all these problems

  • @eproulx
    @eproulx 2 ปีที่แล้ว +3

    @2:40 c+ is not a programming language

  • @Paaco_0
    @Paaco_0 ปีที่แล้ว

    The guy that solve the second problem was so confident, he sould start a youtube channel

  • @idk6465
    @idk6465 2 ปีที่แล้ว +1

    4:10 this is easy to solve in python when you use libraries. But uh it gets fcked when you do it manually.

  • @ace2029
    @ace2029 3 ปีที่แล้ว +4

    I've been learning Python for three weeks and saw this video...thought I'd give the Two Sum a shot.
    number_array = [1, 3, 5, 6, 11, 23]
    result = 9
    for number in number_array:
    count = 0
    result_found = False
    while count < len(number_array):
    if number + number_array[count] == result:
    print(f"The result is {number} and {number_array[count]}.")
    quit()
    count += 1

    • @mohanchand4538
      @mohanchand4538 3 ปีที่แล้ว +1

      nice work!

    • @Matthew-xm2eo
      @Matthew-xm2eo 3 ปีที่แล้ว

      Here's my solution:
      nums = [1, 3, 5, 6, 11, 23]
      result = 9
      for i in range(len(nums)):
      result_found = False
      for j in range(len(nums)):
      if nums[i] + nums[j] == result:
      print('The result is ', nums[i], 'and', nums[j])
      if result_found:
      break

    • @mina86
      @mina86 3 ปีที่แล้ว +3

      For added challange and practice, implement an algorithm which runs in
      1) O(n) time and O(n) additional space,
      2) O(n log n) time and O(1) additional space but is allowed to modify input array.
      --- spoilers below ---
      def find_two_sum(total, numbers):
      num_set = set(numbers)
      for num in numbers:
      if total - num in num_set:
      return num, total - num
      raise ValueError()
      def find_two_sum(total, numbers):
      numbers.sort()
      front = 0
      end = len(numbers) - 1
      while front < end:
      a, b = numbers[front], numbers[end]
      if a + b == total:
      return a, b
      elif a + b < total:
      front += 1
      else:
      end -= 1
      raise ValueError()

    • @littricks3631
      @littricks3631 3 ปีที่แล้ว +1

      @@mina86 what on earth is this o(n) shit?I have been seeing a lot about this.

    • @mina86
      @mina86 3 ปีที่แล้ว +2

      @@littricks3631, it expresses how runtime or memory size of the algorithm grows in relation to the size of the problem. See en.wikipedia.org/wiki/Big_O_notation

  • @pythontron8710
    @pythontron8710 3 ปีที่แล้ว +7

    Using a hash map for the two sum problem is really smart and also has the best time complexity.

    • @AK-om5pe
      @AK-om5pe 2 ปีที่แล้ว +1

      Not if the array is sorted :D

    • @user-zb8tq5pr4x
      @user-zb8tq5pr4x 2 ปีที่แล้ว

      nums = [1, 3, 5, 6, 11, 23]
      val = 9
      def twoSum(nums, val):
      for i in range(len(nums)):
      if (f := val - nums[i]) in nums[i:]:
      return f"{nums[i]} {f}"
      print(twoSum(nums,val))
      idk this seems good enough

  • @luckyambitiousnthani2848
    @luckyambitiousnthani2848 2 ปีที่แล้ว +4

    Keep this kind of videos coming man.
    Very inspiring

  • @wenreloz
    @wenreloz 2 ปีที่แล้ว

    Find the numbers in the array that sums up a given number? You can pick two random numbers in the array inside a while loop.

  • @artemych856
    @artemych856 2 ปีที่แล้ว +1

    I'm 18 and I've been studying programming for 1 year at the university without any practice and I solved those problems easily)