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
nice observation in Tree removal
Thankyou
Was waiting for this video. Thanks for uploading
Thankyou
Ohh thanks apne dono upload kar diye🙏🙏
Welcome
brother issi contest ka "tricky or treat" bhi bta do
mere partial test case hi chale ;(
What a explanation brother , Appreciable .
Thankyou ❤️
Nice Content
Thankyou
Sir please help
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
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.
@@pretestpassed157 ok understood thank you very much sir.
@@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
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.
@@pretestpassed157 ok got it. Is the time complexity of erase function o(1) here.