A general way to solve algorithm problems

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

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

  • @diljitpr1764
    @diljitpr1764 5 ปีที่แล้ว +24

    Problem solving is more like backtracking. You start with some notion and then try to validate deep further where the deepest idea which has met all the constraints and requirements by definition is the correct answer. Most computer problems/programming challenges/interview challenges are always tricky, hence the thinking has to be fast which comes with practice. But starting off by writing sample testcases/possible inputs to the problem and reverse engineering the problem could also help in some cases if the solution fails to meet a certain criteria. As far with computer programming challenges are concerned, its all about pattern mapping to problems which we have already solved before(thats how brain works) and then try to figure out a solution from that.

  • @francishalloun7531
    @francishalloun7531 5 ปีที่แล้ว +69

    An algorithm to solve algorithms

  • @kunns123
    @kunns123 5 ปีที่แล้ว +8

    Gaurav, I love the way you communicate and are able to formulate your thought-process into words. In my opinion, that is the ability which makes you stand out from others. Yes, being good at competitive and System design is one thing, but you are a natural teacher.

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

      Yeah he articulates very well

  • @coolDG1
    @coolDG1 7 ปีที่แล้ว +49

    aaaaahh, whenever i am just getting started with something, you come up with a video related to it! Amazing!. I am totally for this method of problem solving. Recently, i have been stuck on some problems by simply either writing code straight away or making changes to it and what not. I try by changing "

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

      Thanks Divyansh! Long, and informative comment :-)

    • @shyamkachhadiya4964
      @shyamkachhadiya4964 6 ปีที่แล้ว

      Xd,, same

    • @cesareborgia9259
      @cesareborgia9259 5 ปีที่แล้ว

      This is a good observation. I do this all the time, and it feels like a huge waste of my time.

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

    Hi Gaurav,
    You have given a wonderful roadmap to develop problem solving strategy. This reminds me of the first principles approach to deconstruct the problem into smaller pieces and then work methodically. Once again thanks a lot.

  • @webartisan5500
    @webartisan5500 6 ปีที่แล้ว +144

    I didn't get it that you were talking about prime numbers. I should go to sleep now :( good content. Subscribed.

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

    Love the enthusiasm my man! Also, great explanation! Subscribed and liked!

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Much appreciated!

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

    We need more videos like this!

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

    Learning a lot from your channel. I am a failed programmer, hope one day I will get a good job because of you. Thanks for the wonderful video.

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

      Good luck for you, bro :)

    • @denniszenanywhere
      @denniszenanywhere 5 ปีที่แล้ว

      Man, I am a failed programmer, too. I cannot solve any problem.

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

      Hey, it has been a year since you wrote this comment. Any good news yet?

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

      I'm interested too

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

      @@xordux7 How could I get notifications for this thread?

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

    Thanks Gaurav.. finally i have started reading the text on questions and practicing to represent input formats..

  • @NevilleIsGod
    @NevilleIsGod 5 ปีที่แล้ว +8

    Sometimes the algorithm we choose defines the representation. But this is a good map to consider

  • @MrGlujaN
    @MrGlujaN 6 ปีที่แล้ว +5

    Thank you Gurav!, Your general approach to Problem solving, make me more confident in solving problems.
    I use it in college to pass finals and really works!

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      Awesome work Sebastian, congrats!

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

    Super useful brother...thanks a ton ❤️..much love

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

    systematic way to solve the problems.Liked it

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

    I am an aspiring coder and twice I have cracked Google code jam round 1. Two days back on 9th Feb ,i went to an interview in a product based company. I was asked to write a code on fibonacci series. Believe me , I started thinking of the for loops and damn I wsnt able to code it :( . I was just thinking of a reason and I guess ur video pretty much answers it. It's not how much u can code.but with what approach u get the solution . Thankful to u . Will be exploring the links in the description . And would be thankful if u can comment some examples where u have used the above approach or maybe post a video

    • @prajwalkale2687
      @prajwalkale2687 5 ปีที่แล้ว

      Can you tell me plz From where you learned competitive programming

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

    Observation on sample examples works for most of the time.....observing the pattern in it is main thing...

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

    Interview tomorrow and am super nervous! this was very helpful btw

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

    Helped me alot thank you, I can see that you are going to be a teacher in the future

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

    Awesome Bro!
    Pretty objective, thanks for share, cheers from Brazil o/

  • @RaviShankar-ok1kh
    @RaviShankar-ok1kh 6 ปีที่แล้ว +3

    You have a 1000-card deck with cards numbered from 0 to 999 that you'd like to sort. You have a small table to sort the cards on, which can hold up to 64 piles of cards. You can't stick cards in the middle of a pile, but you can split a pile into additional piles (as long as you don't go over the limit).
    Can you describe out a good way to sort the entire deck of cards?

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

    3:42 Minimized the video and googled "what the hell is a link-cut tree ?".

  • @vulturebeast
    @vulturebeast 5 ปีที่แล้ว +12

    Have you applied this approach anywhere ? And what are your results regarding the same? PS: I will experiment with the exact framework for a week or so, thanks Gaurav for this :)

  • @labuewilfred2259
    @labuewilfred2259 4 ปีที่แล้ว

    This a very good approach , thanks

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

    good lesson, and thanks. it’s basically a feedback loop

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

    Nice thought process :)

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

    GKCS, you are amazing, Thanks for awesome videos

    • @gkcs
      @gkcs  7 ปีที่แล้ว

      Thanks Ashish!

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

    How do you expect us to get what any of this means if you don't demonstrate with an example?

  • @meenushukla4321
    @meenushukla4321 4 ปีที่แล้ว

    A very very good video I can understand full video

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Glad to hear that!

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

    2. Representation. Have you elaborated it anywhere on your another video perhaps?

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      All the AI videos needed it. When dealing with a complex problem, representation is a key part of problem solving.
      My recent system design videos are very focused on the representation aspect.

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

    This is really beautiful.

  • @ankushm3t
    @ankushm3t 4 ปีที่แล้ว

    How to Solve it by G. Polya has an approach for math, applies to pretty much any computational problem too.

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

    Hello Gaurav,
    I always dream of becoming good engineer who knows everything like time complexity, space complexity etc but when I try to read or solve Data structure it seems to be very boring to me, I am having 2year exp in JavaScript (Angular) etc

  • @NewsNachrichtenGermany
    @NewsNachrichtenGermany 4 ปีที่แล้ว

    Thanks Gaurav.

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

    Good one, Gaurav Sir... I endorse this method greatly as I have practically applied it and I've been successful. Regards.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Glad to hear that 😁

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

    I wish we were in same college and we did interesting things like this🙆‍♂️😂...I mean there is so much to learn from you and it's such a fun....
    I would also appreciate if you can make a video on...How are you learning all this😂..so resourceful.

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

      Hahaha, maybe someday 😁

  • @inioluwa3413
    @inioluwa3413 4 ปีที่แล้ว

    Are prime numbers the same as odd numbers.. I'm talking about the example you gave 1

  • @SAM-ro1vv
    @SAM-ro1vv 6 ปีที่แล้ว +4

    Which language should I implement algorithms I k now c , python, java

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

      +Incredible India You should try Malbolge, it does make life simpler. :-p
      On a serious note, any of the above are good enough to start with.

    • @KunalSwami
      @KunalSwami 5 ปีที่แล้ว

      @@gkcs Hmm, in my opinion Brainfuck (en.wikipedia.org/wiki/Brainfuck) is better at making life simpler :P
      EDIT: Just read that Malbolge is built on the difficulty of Brainfuck and Befunge.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      @@KunalSwami Hahaha, exactly!

  • @rahulbhatia1313
    @rahulbhatia1313 7 ปีที่แล้ว +9

    1:39

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

    Maybe we can look at Approach and Strategy as different points...I could say I have multiple approaches, for each approach I have multiple strategies..what is your view on this?? Finally you mentioned that this works in long term contests and not in short term contests.. I assume you mean there is no time to go through the entire waterfall and just dive into some of these areas and attempt to get a solution. But is there a specific approach for quick solutions.

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      You make a good point. One must adapt their methods according to circumstances.

  • @dhanushk.s.5632
    @dhanushk.s.5632 4 ปีที่แล้ว

    Hi Gaurav i recently came to know about your channel and im glad i found it. I need a few suggestions before i start solving problems in coding platforms such as Hackerrank, codeforces etc pls share you experience in learning data structures and algorithms ,im lacking the skill to apply the right algorithm for a given problem How do I overcome this??

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      I find Codeforces the best amongst them.

    • @dhanushk.s.5632
      @dhanushk.s.5632 4 ปีที่แล้ว

      @@gkcs Thank you

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

    Please give me some advice. I really need it.
    I did a codechef long challenge and solved 5 out of 8 problems in many days and many hours.
    Then I came to codeforces and saw the last div 2 contest problems.. I can't even solve the A, B and C problems there. I saw the tutorials but still can't understand the explanation after trying to understand it for hours.
    I am really disappointed and I know I have to do it anyhow as this summer I need to get into a good company. Please tell me what should I do in such a situation.

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

    please provide tutorial on when and which data structure to implement depending up on the situation.

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

      Sidhant Mishra It is easy to find which data structure to use while looking at the problem, the main catch is to code it and make it accepted.

    • @coolDG1
      @coolDG1 7 ปีที่แล้ว +13

      Solving problems in competitive programming is mainly breaking down the unknown problem to a set of known problems. So the more problems you know the better your chances of success are. Just keep reading editorials, tutorials, new algorithms , data structure and keep solving problems. Knowing what data structure to implement will come to you only by practice.
      Although looking at constraints give you a pretty good idea.

  • @yashchoudhary4791
    @yashchoudhary4791 4 ปีที่แล้ว

    VERY NICE APPROACH IT REALLY HELPED ME😊

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

    I wish I could like this video more than once :)

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

      Anmol Mishra Yes offcourse you can like the video twice...😂

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

    What the hell? I was searching about youtube algorithm and I clicked on it expecting something like that but its a maths problem 🤣🤣🤣At first I got confused but now I understood 🤦🏻‍♀️

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

    Man I love You. awesome Bro

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

    I think I am very dumb to solve
    computer science problem.. Can I still solve the problem with this approach?

  • @juanefrainpaquiyauri6590
    @juanefrainpaquiyauri6590 4 ปีที่แล้ว

    This is very helpful for me

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

    Do u live out of india

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

    Can u please explain this by taking one problem and then apply these pointers so that it could be more clear what each pointer practically means.

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

    Please make a video on stl maps, set

  • @Avatar911
    @Avatar911 5 ปีที่แล้ว

    Could you please tell the best book to learn Data structures and algorithms...

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

      Google it.

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

    Can you make a video of Wavelet Trees ? :D

    • @gkcs
      @gkcs  7 ปีที่แล้ว

      Reading up on it. Seems very interesting...

    • @martjao
      @martjao 7 ปีที่แล้ว

      Coool :D

    • @xordux7
      @xordux7 4 ปีที่แล้ว

      He made the video.. th-cam.com/video/CybAgVF-MMc/w-d-xo.html .... Gaurav is awesome!

  • @tkbhateja2071
    @tkbhateja2071 4 ปีที่แล้ว

    I think first 3 steps are always done in our mind :p :p

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

    U wont tell dp and its thought process , right??

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

      I am going to mentioning this comment in the next video. :-P
      Wait for my answer there!

  • @fahmiirfan6923
    @fahmiirfan6923 6 ปีที่แล้ว

    Sometimes we already know the definiton, represenstation, & the approach phase, so we jump to the algorithm phase.

  • @shivamraj2649
    @shivamraj2649 6 ปีที่แล้ว

    Bro you are doing really good thanks yaar
    Or tmhara playlists sab v series mai ha
    I am getting started with learning programming so any tips and way to learn and path
    I think i should go through you playlists one by one from top to bottom by learning and applying it

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      That's the way :)

  • @vivekchadha4109
    @vivekchadha4109 7 ปีที่แล้ว

    sir please provide detail explanation of basic graph problems with stl implementation

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

    I actually think like how my brain will solve this problem, I my brain can't do it, I certainly can't write any algorithm for it.

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

    yep! this approach wouldn't be that helpful in short contests, where you see the first solution on the table in minutes.
    It would be very helpful if you make a video on optimising dp problems after finding the recursive solution. Things like eliminating parameters and changing the state of the problem.

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

      You still go through this procedure, just in your head :). And since problems in short contests are relatively easier to crack we think i just coded the solution right away!

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

    hello, I'm a student at university and I've got a question... Does it normal not to be able to solve the algorithm problems?

  • @KaziAmitHasan
    @KaziAmitHasan 5 ปีที่แล้ว

    Great video

  • @blocksofcode7631
    @blocksofcode7631 6 ปีที่แล้ว

    What is mean of gkcs

  • @wettmarley
    @wettmarley 5 ปีที่แล้ว

    u earned a sub today

  • @Chandyshot
    @Chandyshot 7 ปีที่แล้ว

    problems where given an array and we need to find something based on gcd of all possible subarrays or subsequences, I can't make efficient way to solve these problems, can you help me with some of the named techniques.... any video or any comment regarding gcd topics will be helpful..

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

      Most such GCD problems require us to do some precomputation or answer in ranges. You could try the problem:
      www.codechef.com/problems/GCDQ
      I will be making something on GCD soon. :-)

    • @Chandyshot
      @Chandyshot 7 ปีที่แล้ว

      somewhat similar to XOR problems??

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

      Yes, ranges tend to do that. But sometimes you need to work out a bit of math to simplify the query for the subarray

  • @rahulshetty3738
    @rahulshetty3738 7 ปีที่แล้ว

    if possible,please make a video on June long challenge PRMQ problem.

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

      Hi Rahul!
      I am considering it...might skip it though, because it uses data structures we have previously talked about.

  • @kushaldey9428
    @kushaldey9428 7 ปีที่แล้ว

    can you plz upload the videoes on codechef snackdown elimination round contest held on 3rd june...

  • @bismeetsingh352
    @bismeetsingh352 6 ปีที่แล้ว

    But how do u think of the algorithm in the first place

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      That's the part of problem solving. You define and then represent. The algorithm is a set of steps you choose to solve the problem.

    • @bismeetsingh352
      @bismeetsingh352 6 ปีที่แล้ว

      @@gkcs That's where I get stuck. Finding those steps

  • @ayushgames3764
    @ayushgames3764 5 ปีที่แล้ว

    What is gkcs

  • @parthudawant7015
    @parthudawant7015 4 ปีที่แล้ว

    Maybe having a methodical approach remove the funride we go through while programming. Don't you think so?

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

      Solving problems will always remain an art, regardless of the science behind it.
      A method gives the art some structure. It doesn't take away from the beauty of it though.

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

    please give me a way or some instructions from where and how could i start coding? and one more question in which language? i really want to start competitive programming. i studing cse in public university in bangladesh. thank you :) .

    • @umessr8456
      @umessr8456 5 ปีที่แล้ว

      Start with Python 3 bez its easy

  • @ranam950
    @ranam950 7 ปีที่แล้ว

    Please make some videos on DP , btw love ur channel

    • @gkcs
      @gkcs  7 ปีที่แล้ว

      Coming up next!
      Thanks for the feedback :-)

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

    Me: That's the girl I was talking about, but don't look.
    My friends: 1:39

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

      😂😂

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 5 ปีที่แล้ว

    Good...

  • @andreicompany954
    @andreicompany954 7 ปีที่แล้ว

    Amazing!

    • @gkcs
      @gkcs  7 ปีที่แล้ว

      Thanks Andrei!

  • @AsifSaifuddinAuvipy
    @AsifSaifuddinAuvipy 4 ปีที่แล้ว

    it's good for job interview ;)

  • @eequalsmc2829
    @eequalsmc2829 5 ปีที่แล้ว

    Is this from art of problem solving?

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      It's actually from an MIT professor of AI. You can have a look at the video description.

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

      @@gkcs Thanks

  • @idrispatel7139
    @idrispatel7139 6 ปีที่แล้ว

    I see mostly top ranking coder solve problem in c++ in code jam. Why they are prefer c++ other than?

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

      It's faster than most other languages, so most competitive programmers choose that language. It's also shorter to write than languages like Java.
      However, there are some top competitive programmers who use Java too, like uwi.

  • @alexanderhermes6408
    @alexanderhermes6408 5 ปีที่แล้ว

    Thanks!

  • @ShauryaVlogsUppal
    @ShauryaVlogsUppal 7 ปีที่แล้ว

    Also make a video on query questions, how to solve a query question

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

      If you are talking about Range Minimum Queries, you could have a look at Segment Trees or Sqrt Decomposition.
      Segment Tree: th-cam.com/video/CN0N1ddJ9hA/w-d-xo.html
      Sqrt Decomposition: th-cam.com/video/gWbDocYhwDA/w-d-xo.html

  • @SaiBharatBatchu
    @SaiBharatBatchu 7 ปีที่แล้ว +5

    "in our language means" haha yes we are another world lol

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

    Improve the audio quality please

  • @luckysahu6756
    @luckysahu6756 7 ปีที่แล้ว

    what an expression at 3:04

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

    I have the t-shirt :)

  • @vishakha7493
    @vishakha7493 4 ปีที่แล้ว

    This guy is ceo of whiteboard

  • @ritikpanday9617
    @ritikpanday9617 5 ปีที่แล้ว

    by default I think like that

  • @userd-yo1hf
    @userd-yo1hf ปีที่แล้ว

    what i do. works always
    get problem -> break it to small -> solve one fucking thing at a time -> combine all -> problem solved.. \

  • @sociajl751
    @sociajl751 4 ปีที่แล้ว

    why am I just finding this.....

  • @laminlevrai1758
    @laminlevrai1758 5 ปีที่แล้ว

    I want to master arrays (type od a data structure) manipulation, I'm learning c++, for example how to write an algorithm to rearrange the elements of an array so that the zeros come first than the negative elements next than the positive elements last. Can you make videos about this?

  • @antarsarkar1058
    @antarsarkar1058 6 ปีที่แล้ว

    why don't you show it head on rather than describing....

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      There's videos on editorials on this channel. Try them out 🙂

  • @shyamkachhadiya4964
    @shyamkachhadiya4964 6 ปีที่แล้ว

    AH i have just jumped in compititive programaming a week before, and for mem programming looks wild, XD, every ties all logic needs to get worked , RIp me