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

Поділитися
Вставка
  • Опубліковано 11 жов 2024

КОМЕНТАРІ • 27

  • @josuke21
    @josuke21 3 місяці тому +14

    Your explanation is poor . Atleast dry run the code.

  • @sujansinhthakor2314
    @sujansinhthakor2314 3 місяці тому +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.

  • @shubhamjha2486
    @shubhamjha2486 3 місяці тому +1

    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 !

  • @TLE_Eliminators
    @TLE_Eliminators  3 місяці тому

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

  • @dhruv6102
    @dhruv6102 3 місяці тому

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

  • @VaibhavSingh-rf2ud
    @VaibhavSingh-rf2ud 3 місяці тому

    what about problem f?

  • @captvashu8142
    @captvashu8142 3 місяці тому

    where to learn z algo or other string alfgoS>?

    • @Abc-lr4bf
      @Abc-lr4bf 3 місяці тому

      cp algorithm

    • @kumkumslab5811
      @kumkumslab5811 3 місяці тому

      no need i think sliding window lagao ho jaega

    • @captvashu8142
      @captvashu8142 3 місяці тому

      @@kumkumslab5811 but for similar questions it is must
      \

  • @nityas8049
    @nityas8049 3 місяці тому

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

    • @hashirshaikh510
      @hashirshaikh510 3 місяці тому

      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 3 місяці тому +1

      @@hashirshaikh510 Thank you so much for your explanation

  • @ankitshiksharthi3141
    @ankitshiksharthi3141 3 місяці тому

    Thumbnail??

  • @ayyu_MNNIT_A
    @ayyu_MNNIT_A 3 місяці тому +2

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

  • @akshit6653
    @akshit6653 3 місяці тому +1

    Extremely poor explanation

  • @crazytourist6619
    @crazytourist6619 3 місяці тому +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_ 3 місяці тому +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 3 місяці тому

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

  • @kumkumslab5811
    @kumkumslab5811 3 місяці тому +1

    d wala aache se clear nhi hua

    • @alankritsingh5222
      @alankritsingh5222 3 місяці тому +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 3 місяці тому

      @@alankritsingh5222 ohk got it thanks

  • @nishanttyagi3665
    @nishanttyagi3665 3 місяці тому

    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

  • @iitianshah_1502
    @iitianshah_1502 3 місяці тому +2

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

  • @TheBaljitSingh
    @TheBaljitSingh 3 місяці тому

    explanation can be better

  • @ankitris5201
    @ankitris5201 3 місяці тому

    poor explanation