Codechef | Starters 140 | Tree Removal | Break The String | Editorial | Simple Solution.

Поділитися
Вставка
  • Опубліковано 2 лип 2024
  • Codechef | Starters 140 | Tree Removal | Break The String | Editorial | Simple Solution.
    Tree Removal Solution : www.codechef.com/viewsolution...
    Break The String : www.codechef.com/viewsolution...
    CODECHEF
    STARTERS
    140
    STARTERS140
    TREEREMOVAL
    BREAKTHESTRING
    Codechef
    Starters 140
    Tree Removal
    Break The String
    #codechef
    #starters
    #140
    #treeremoval
    #breakthestring
    #Starters139
    #bitwise
    #AND
    #SumofModes
    #lexicographicallymaximalprefixand
    #and
    #hindicodingtutorial
    #codechefcontest
    #hindisolution
    #ProgrammingTutorial
    #AlgorithmExplanation
    #StringManipulation
    #codinginhindi
    #CodeChefContest
    #problemsolving
    #BinaryStrings
    #programminginhindi
    #CompetitiveProgrammingTutorial
    #AlgorithmExplanationInHindi
    #StringManipulationTutorial
    #codingtutorial
    #HindiCodingTutorial
    #CodeChefContest
    #problemsolving
    #BinaryStrings
    #programminginhindi
    #CompetitiveProgrammingTutorial
    #AlgorithmExplanationInHindi
    #StringManipulationTutorial
    #codingtutorial
    #HindiCodingTutorial
    #algorithmanalysis
    #programminglogic
    #problemsolvingtechniques
    #StringManipulationTechniques
    #codeexplanation
    #HindiProgrammingTutorial
    #codingtips
    #programmingeducation
    #OnlineProgrammingContest
    #ProgrammingSkills
    #computersciencetutorial
    00:00 Tree Removal
    18:57 Break The String

КОМЕНТАРІ • 18

  • @ronakkriplani1838
    @ronakkriplani1838 5 днів тому +2

    nice observation in Tree removal

  • @gyanikumari4973
    @gyanikumari4973 5 днів тому +2

    Was waiting for this video. Thanks for uploading

  • @ronakkriplani1838
    @ronakkriplani1838 5 днів тому +2

    Ohh thanks apne dono upload kar diye🙏🙏

  • @anshumaan1024
    @anshumaan1024 День тому +1

    brother issi contest ka "tricky or treat" bhi bta do
    mere partial test case hi chale ;(

  • @adityatiwari80
    @adityatiwari80 2 дні тому +1

    What a explanation brother , Appreciable .

  • @reactcode9148
    @reactcode9148 5 днів тому +1

    Nice Content

  • @kiranvats9503
    @kiranvats9503 5 днів тому

    Sir please help

  • @kiranvats9503
    @kiranvats9503 5 днів тому +1

    Sir please please help me with this for fifth question giving run time error
    I do not know string hashing so i use 3 vectors that store prefix strting suffix string and the current string with length n/2. Giving. Run time error on 5 th hidden test case . Took more than 5 hour
    #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

    • @pretestpassed157
      @pretestpassed157  5 днів тому +1

      1. What will be the overall size of the prefix or suffix ?
      2. 1+2+3+4+.........+10^5 that is more then 10^10.
      3. But we can't use the space complexity inside the function more than 10^6 and outside the function as more than 10^8.
      4. So it's giving runtime error.

    • @kiranvats9503
      @kiranvats9503 4 дні тому +1

      ​@@pretestpassed157 ok understood thank you very much sir.

    • @kiranvats9503
      @kiranvats9503 4 дні тому +1

      @@pretestpassed157
      why is this giving tle and what is the expected time complexity for this question. Now i am not using the extra memory for prefix and suffix array
      #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;
      string prefix="",suffix="",mera="";
      for(int i=0;i

    • @pretestpassed157
      @pretestpassed157  4 дні тому +1

      What will be the size of mera and suffix. It's n/2
      And for each iteration from 0 to n,
      You are just checking either ( prefix + mera + suffix == s ) so this check itself will take n time complexity.
      And this check is done inside each iteration from 0 to n so the overall time complexity will be n*n that is n^2 so it's giving TLE.

    • @kiranvats9503
      @kiranvats9503 3 дні тому +1

      @@pretestpassed157 ok got it. Is the time complexity of erase function o(1) here.