Codechef Starters 140 | Video Solutions - A to E | by Ankit Ghildiyal | TLE Eliminators

Sdílet
Vložit
  • čas přidán 23. 07. 2024
  • Here are the video solutions in the form of a post-contest discussion for problems A, B, C, D, E of Codechef Starters 140 (Div 2). The live discussion was done with students of TLE Eliminators, this is the recording of the same. We hope this will be useful for you in up-solving this contest.
    📢Check out handpicked problems by Priyansh himself, on our CP-31 sheet: www.tle-eliminators.com/cp-sheet
    Solution Codes:
    Problem A: pastebin.com/MDr6a4Qt
    Problem B: pastebin.com/qGGBPu0H
    Problem C: pastebin.com/wyM10aFe
    Problem D: pastebin.com/HpnBHL8x
    Problem E: pastebin.com/i2s8uK7r
    Be sure to check out TLE Eliminators.
    Website: www.tle-eliminators.com/
    Instagram: / tle_eliminators
    Linkedin: / tle-eliminators
    Twitter: / tle_eliminators
    TLE Community Discord Server: / discord
    Timestamps:-
    0:00 Problem A
    5:10 Problem B
    11:35 Problem C
    20:29 Problem D
    29:06 Problem E

Komentáře • 27

  • @josuke21
    @josuke21 Před 27 dny +14

    Your explanation is poor . Atleast dry run the code.

  • @sujansinhthakor2314
    @sujansinhthakor2314 Před 27 dny +1

    for problem c, if you just try to come up with answer of n = 4,5,6,7 then you eventually you will get the pattern.

  • @VaibhavSingh-rf2ud
    @VaibhavSingh-rf2ud Před 27 dny

    what about problem f?

  • @shubhamjha2486
    @shubhamjha2486 Před 27 dny

    Just great explanations. Big fan 🙏. Also , can you please tell me how to be so good at proving your solutions I mean you're just great !

  • @ankitshiksharthi3141
    @ankitshiksharthi3141 Před 27 dny

    Thumbnail??

  • @nityas8049
    @nityas8049 Před 27 dny

    In problem D how does it make sure that it will print odd degree nodes only? If anyone knows please explain..

    • @hashirshaikh510
      @hashirshaikh510 Před 26 dny

      In a tree, if you check, all leaf nodes have a degree = 1
      So you can remove all leaf nodes first, and once you remove them, their parents will become the leaf node of the new tree formed due to their removal.
      And so on, you can just go on removing the leaf nodes until only root node is left
      So you can always remove n-1 nodes... basically just go on removing leaf nodes, then next set of leaf nodes...so on uptil only root node is left
      He is doing a dfs, where he is passing the vertex and its parent.
      When the dfs function is returning from its function call, it means the node now has no more children, and he is making a check that vertex != Parent ,which means its a leaf node, and hence you can just print it
      In this way you will print all leaf nodes in order uptil only the root node is left

    • @nityas8049
      @nityas8049 Před 25 dny +1

      @@hashirshaikh510 Thank you so much for your explanation

  • @dhruv6102
    @dhruv6102 Před 23 dny

    came for question B. Sorry sir but not able to understand !

  • @captvashu8142
    @captvashu8142 Před 26 dny

    where to learn z algo or other string alfgoS>?

    • @Abc-lr4bf
      @Abc-lr4bf Před 26 dny

      cp algorithm

    • @kumkumslab5811
      @kumkumslab5811 Před 26 dny

      no need i think sliding window lagao ho jaega

    • @captvashu8142
      @captvashu8142 Před 25 dny

      @@kumkumslab5811 but for similar questions it is must
      \

  • @nishanttyagi3665
    @nishanttyagi3665 Před 26 dny

    can someone please help me with this for fifth question giving run time error
    #include
    using namespace std;
    int main()
    {
    int t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    int ans=0;
    int n=s.length();
    if(n%2!=0) ans=0;
    else{
    int x=n/2;
    vectorprefix(n),suffix(n),mera(n);
    for(int i=0;i=0)
    prefix[i]=prefix[i-1]+s[i];
    else prefix[i]=s[0];
    }
    for(int i=n-1;i>=0;i--){
    if(i

  • @TLE_Eliminators
    @TLE_Eliminators  Před 27 dny

    Please fill the feedback form: forms.gle/3zBtR5zkbaVrxKzh7

  • @crazytourist6619
    @crazytourist6619 Před 27 dny +1

    Can anyone help me with TREE REMOVAL problem ? I did the same approach and implemented but code gives WA on hidden testcase, I'm unable to debug.. If anyone can help me find the testcase on which it is failing..
    MY CODE :
    #include
    using namespace std;
    #define int long long int
    #define endl "
    "
    #define all(v) (v).begin(), (v).end()
    #define vi vector
    void dfs(map &mp, int node, int parent, vector &vec)
    {
    for (auto ele : mp[node])
    {
    if (ele != parent)
    {
    dfs(mp, ele, node, vec);
    }
    }
    vec.push_back(node);
    }
    void solve()
    {
    int n;
    cin >> n;
    vector v;
    for (int i = 0; i < n; i++)
    {
    int x;
    cin >> x;
    v.emplace_back(x);
    }
    map mp;
    for (int i = 0; i < n - 1; ++i)
    {
    int u, v;
    cin >> u >> v;
    mp[u].push_back(v);
    mp[v].push_back(u);
    }
    int node = *(min_element(all(v)));
    cout

    • @_dragneel_
      @_dragneel_ Před 26 dny +1

      I think you are considering the min value as root but not the node with min value. For example, values are [6,7,8,5] then in your case root is 5 but it should be 4 (1-based indexing)

    • @crazytourist6619
      @crazytourist6619 Před 26 dny

      @@_dragneel_ Oh yes that was the problem. I confused indices and values. Thank you so much for pointing it out. 🙏🏼🫂

  • @kumkumslab5811
    @kumkumslab5811 Před 27 dny +1

    d wala aache se clear nhi hua

    • @alankritsingh5222
      @alankritsingh5222 Před 27 dny +1

      jiski value minimum ho usko root assume kro aur kisi bhi tree me root hi hogi jo kabhi bhi ans me add nhi hogi(kyuki end me uski degree 0)hogi aur leaf ki degree 1 h to bottom to up move kro aur value ko score me add kro aur leaf ko store kr dena

    • @kumkumslab5811
      @kumkumslab5811 Před 26 dny

      @@alankritsingh5222 ohk got it thanks

  • @_ayush_NIT_Allahabad
    @_ayush_NIT_Allahabad Před 27 dny +2

    bakwas explaination, na sound hai, na dry run. should give more time on explanation and intution than just showing the code

  • @TheBaljitSingh
    @TheBaljitSingh Před 26 dny

    explanation can be better

  • @iitianshah_1502
    @iitianshah_1502 Před 27 dny +2

    yaar es bhaiya ka itna ganda explanation h , raghav bhiaya is fine

  • @akshit6653
    @akshit6653 Před 26 dny +1

    Extremely poor explanation

  • @ankitris5201
    @ankitris5201 Před 13 dny

    poor explanation