A general way to solve algorithm problems

Поділитися
Вставка
  • Опубліковано 8 лис 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.

  • @kunns123
    @kunns123 4 роки тому +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

  • @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.

  • @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.

  • @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?

  • @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!

  • @francishalloun7531
    @francishalloun7531 5 років тому +69

    An algorithm to solve algorithms

  • @mowahidlatif5006
    @mowahidlatif5006 3 роки тому +3

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

    • @gkcs
      @gkcs  3 роки тому

      Much appreciated!

  • @ksansudeen
    @ksansudeen 4 роки тому +3

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

  • @kaizen6163
    @kaizen6163 2 роки тому +1

    We need more videos like this!

  • @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

  • @andybarajas2696
    @andybarajas2696 4 роки тому +5

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

  • @praveennaikg8171
    @praveennaikg8171 4 роки тому +1

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

  • @NevilleIsGod
    @NevilleIsGod 4 роки тому +8

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

  • @khadeejamastoor4992
    @khadeejamastoor4992 3 роки тому

    systematic way to solve the problems.Liked it

  • @Dannnieeye
    @Dannnieeye 3 роки тому

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

  • @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 😁

  • @AnonymousProdigy
    @AnonymousProdigy 2 роки тому

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

  • @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 😁

  • @matthewslaton1366
    @matthewslaton1366 3 роки тому

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

  • @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 :)

  • @nishantkumarbundela8482
    @nishantkumarbundela8482 4 роки тому +9

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

  • @TheErichX
    @TheErichX 3 роки тому +1

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

  • @ashishrana6815
    @ashishrana6815 7 років тому +2

    GKCS, you are amazing, Thanks for awesome videos

    • @gkcs
      @gkcs  7 років тому

      Thanks Ashish!

  • @ankushm3t
    @ankushm3t 4 роки тому

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

  • @labuewilfred2259
    @labuewilfred2259 4 роки тому

    This a very good approach , thanks

  • @meenushukla4321
    @meenushukla4321 4 роки тому

    A very very good video I can understand full video

    • @gkcs
      @gkcs  4 роки тому

      Glad to hear that!

  • @ishumishra8104
    @ishumishra8104 4 роки тому +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

  • @solomonhopewellkembo
    @solomonhopewellkembo 3 роки тому

    This is really beautiful.

  • @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 🤦🏻‍♀️

  • @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?

  • @NewsNachrichtenGermany
    @NewsNachrichtenGermany 4 роки тому

    Thanks Gaurav.

  • @hanseldsilva2393
    @hanseldsilva2393 4 роки тому +3

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

  • @phanindrakumar5112
    @phanindrakumar5112 3 роки тому

    Nice thought process :)

  • @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

  • @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.

  • @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.

  • @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...😂

  • @inioluwa3413
    @inioluwa3413 4 роки тому

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

  • @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!

  • @tkbhateja2071
    @tkbhateja2071 4 роки тому

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

  • @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.

  • @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.

  • @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 :)

  • @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

  • @yashchoudhary4791
    @yashchoudhary4791 4 роки тому

    VERY NICE APPROACH IT REALLY HELPED ME😊

  • @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.

  • @fahmiirfan6923
    @fahmiirfan6923 6 років тому

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

  • @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!

  • @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.

  • @KaziAmitHasan
    @KaziAmitHasan 5 років тому

    Great video

  • @ridwanmugdha7623
    @ridwanmugdha7623 4 роки тому +1

    Man I love You. awesome Bro

  • @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.

  • @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?

  • @ranam950
    @ranam950 7 років тому

    Please make some videos on DP , btw love ur channel

    • @gkcs
      @gkcs  7 років тому

      Coming up next!
      Thanks for the feedback :-)

  • @wettmarley
    @wettmarley 5 років тому

    u earned a sub today

  • @vivekchadha4109
    @vivekchadha4109 7 років тому

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

  • @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!

  • @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.. ua-cam.com/video/CybAgVF-MMc/v-deo.html .... Gaurav is awesome!

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 5 років тому

    Good...

  • @joonmoon7535
    @joonmoon7535 4 роки тому +1

    Do u live out of india

  • @ShauryaVlogsUppal
    @ShauryaVlogsUppal 7 років тому +1

    Please make a video on stl maps, set

  • @SaiBharatBatchu
    @SaiBharatBatchu 6 років тому +5

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

  • @rahulbhatia1313
    @rahulbhatia1313 7 років тому +9

    1:39

  • @vishakha7493
    @vishakha7493 4 роки тому

    This guy is ceo of whiteboard

  • @andreicompany954
    @andreicompany954 6 років тому

    Amazing!

    • @gkcs
      @gkcs  6 років тому

      Thanks Andrei!

  • @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.. \

  • @Avatar911
    @Avatar911 5 років тому

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

    • @gkcs
      @gkcs  5 років тому +1

      Google it.

  • @alexanderhermes6408
    @alexanderhermes6408 4 роки тому

    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: ua-cam.com/video/CN0N1ddJ9hA/v-deo.html
      Sqrt Decomposition: ua-cam.com/video/gWbDocYhwDA/v-deo.html

  • @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.

  • @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?

  • @AsifSaifuddinAuvipy
    @AsifSaifuddinAuvipy 4 роки тому

    it's good for job interview ;)

  • @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

  • @ritikpanday9617
    @ritikpanday9617 5 років тому

    by default I think like that

  • @arjunkhanna1803
    @arjunkhanna1803 3 роки тому

    Improve the audio quality please

  • @bismeetsingh352
    @bismeetsingh352 5 років тому

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

    • @gkcs
      @gkcs  5 років тому

      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 5 років тому

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

  • @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

  • @naveenslog
    @naveenslog 5 років тому +1

    I have the t-shirt :)

  • @sociajl751
    @sociajl751 4 роки тому

    why am I just finding this.....

  • @kushaldey9428
    @kushaldey9428 7 років тому

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

  • @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

  • @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

  • @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.

  • @blocksofcode7631
    @blocksofcode7631 6 років тому

    What is mean of gkcs

  • @ayushgames3764
    @ayushgames3764 5 років тому

    What is gkcs

  • @luckysahu6756
    @luckysahu6756 7 років тому

    what an expression at 3:04

  • @alperkalamanoglu4660
    @alperkalamanoglu4660 3 роки тому

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

    • @gkcs
      @gkcs  3 роки тому

      😂😂

  • @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 🙂