CodeChef Starters 135 (Div2) | Video Solutions - A to D | by Viraj Chandra | TLE Eliminators

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 31

  • @TLE_Eliminators
    @TLE_Eliminators  6 месяцев назад +1

    Please fill the feedback form : forms.gle/FA7EiUj68e1R3TAQ7

  • @anonymous10906
    @anonymous10906 6 месяцев назад +26

    This man has got some real talent on explaining things!!Hats off

  • @NeverLoose-v5i
    @NeverLoose-v5i 6 месяцев назад +6

    Please I want all post contest video from you great teaching style at all..

  • @polyakter3969
    @polyakter3969 6 месяцев назад +14

    Your explanation and efforts are at another level

  • @YupIam-f4t
    @YupIam-f4t 6 месяцев назад +2

    What an explanation bro,u just rocked!!

  • @GauravDuseja-t6q
    @GauravDuseja-t6q 6 месяцев назад

    Very Good Explanation thanku bhaiya

  • @kushaljha5415
    @kushaljha5415 6 месяцев назад

    I don't usually comment on videos but you sir great. Very well explained.@Priyansh give this man a raise xD

  • @YupIam-f4t
    @YupIam-f4t 6 месяцев назад +2

    Heyyy u r awesome!!!!!!

  • @dank7044
    @dank7044 6 месяцев назад +3

    i dont know why i couldnt figure out qsn2,within one code, i calculated operations by multiple methods and took min of that,but somehow i missed this idea and didnt try it

    • @VirajChandra
      @VirajChandra 6 месяцев назад +2

      Hi! It’s absolutely okay. It’s a first time for everything, and I’m sure you will now be able to easily score such problems. Takeaway - think backwards!

    • @dank7044
      @dank7044 6 месяцев назад

      @@VirajChandra not able to do this took me from 3* to 2* maybe that's why its hurting more than usual

  • @abcd76820
    @abcd76820 6 месяцев назад +2

    can anyone tell me why this fails coz we want to cover difference between b and a using subtraction and division
    while(t-- > 0)
    {
    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int diff = b-a ;
    int operation = 0;
    // we want all gaps to be covered
    if(diff/k >=a)
    {operation = diff / k ;
    diff = diff%k;
    }
    operation += diff-a ;
    System.out.println(operation);
    }

    • @VirajChandra
      @VirajChandra 6 месяцев назад

      I think you are confusing by dividing diff by k. In reality the number b is getting operated on which is way different than this. Try with some simple testcase.

  • @manishkumar-uw5mw
    @manishkumar-uw5mw 6 месяцев назад +2

    in c let node value is 4 but is is at distance 6 from node 1 and let there is another node with value 6 but at distance of 3 and both value are greater than node 1 value so we should choose 6*3 rather than 4*6 and it contradicts your facts that we will choose a node with lesser value and which is at leftmost. please help!

    • @VirajChandra
      @VirajChandra 6 месяцев назад +1

      Think even further to this. Let’s say now you want to reach the last node, because you took 6 which was greater than 4, your max will still remain 6 which gives you a bigger answer on reaching last node.

  • @iraj628
    @iraj628 6 месяцев назад +2

    Lot of people have done c through stack.... is it a standard question

    • @VirajChandra
      @VirajChandra 6 месяцев назад +4

      Yes, the idea of creating a decreasing/increasing node pattern from first node is monotonic stack question. Hence stack is used. You can look up monotonic stack on any resource, and you will find plenty of questions to practice.

    • @SohailKhan-cx9gb
      @SohailKhan-cx9gb 6 месяцев назад +2

      We can also do it by dijkstra but in this case we have to remove unwanted edges in the graph construction

    • @VirajChandra
      @VirajChandra 6 месяцев назад +2

      Yes, as I mentioned during problem explaining that this can be solved with graph construction also by removing unwanted edges.

  • @dipbaldha5903
    @dipbaldha5903 6 месяцев назад +2

    (graph cost ) greedy traversal
    ll n;
    cin>>n;
    vin(temp , n);
    ll ans2 = 0;
    ll m1 = temp[0];
    ll p1 = 1;
    ll m2 = temp[n-1];
    ll p2 = n;
    fi(1 , n-1)
    {
    if(temp[i]

    • @youknowwho321
      @youknowwho321 6 месяцев назад

      can you please give your submission link

  • @jeetoppers3150
    @jeetoppers3150 6 месяцев назад

    Hey I also want to join discussion meeting ,Please tell how to join

  • @vitaminprotein2217
    @vitaminprotein2217 6 месяцев назад +2

    in A to B rec/dp solution works!!

    • @VirajChandra
      @VirajChandra 6 месяцев назад +2

      Is that so? Please show some submission link.

    • @SohailKhan-cx9gb
      @SohailKhan-cx9gb 6 месяцев назад +3

      @@VirajChandra sir we can do it like this -->
      int f(int a,int b,int k){
      if(b> t;
      while(t--) {
      int a,b,k;
      cin>>a>>b>>k;
      cout

    • @Sheldor.The.Conqueror
      @Sheldor.The.Conqueror 6 месяцев назад

      @@SohailKhan-cx9gb This is not giving correct output on Codechef compiler. Output there is :
      -2147483644
      -2147483647
      -2147483645
      -2047483646

    • @SohailKhan-cx9gb
      @SohailKhan-cx9gb 6 месяцев назад +1

      @@Sheldor.The.Conqueror I have defined int as long long u can change 1e18 to 1e9 and see if it works? Or u can just change int to long long in ans ,a,b,k and f hope it helps

    • @VirajChandra
      @VirajChandra 6 месяцев назад +2

      Your solution is based again on the fact that you are going from b to a and not a to b. I think recursion for a to b will not work, that is what I meant.