see this my solution using substr func (after contest) → CodeChef: Practical coding for everyone
bhai…there are sites where all languages have same time limit.
codechef atleast has 5X for python.
if u are using python from so long…then u should know when it works
and when to use c++.
I mean yea, In such a scenario nothing would be fair lol
What did I do wrong then?
Is there any slight modification that will help me get it accepted or should I entirely change my approach?
Inbuilt functions are optimised. Thats why they are generally faster.
i m nt using python…and i dont think python has “5x” time limit either…
I don’t think anything should be done now. I in fact did not submit thinking O(n*n) would not pass. Only thing is that from future they should take care of test cases.
Now will they make the contest unrated or re-evaluate all the solutions and update the rating?
Nothing hppen gonna bro chill and do coding
Not Possible … rating updated
Chill man Rating hi to h
The official replies are here:
Apologies again for the issue.
can you please whcek why TLE issue coming in this code
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0)
{
String s=sc.next();
int n=s.length();
int count=0;
String s1="",s2="",s3="",s4="";
for(int i=2;i<(n-2);i+=2)
{
s1=s.substring(0,i/2);
s2=s.substring(i/2,i);
// System.out.println("ii:"+ii);
if(s1.equals(s2))
{
s3=s.substring(i,i+ (n-i)/2);
s4=s.substring(i+(n-i)/2,n);
if(s3.equals(s4))
count++;
}
}
System.out.println(count);
}
}
}
still i am getting TLE issue
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0)
{
String s=sc.next();
int n=s.length();
int count=0;
String s1="",s2="",s3="",s4="";
for(int i=2;i<(n-2);i+=2)
{
s1=s.substring(0,i/2);
s2=s.substring(i/2,i);
// System.out.println("ii:"+ii);
if(s1.equals(s2))
{
s3=s.substring(i,i+ (n-i)/2);
s4=s.substring(i+(n-i)/2,n);
if(s3.equals(s4))
count++;
}
}
System.out.println(count);
}
}
}
@ssrivastava990 can you please check my code and tell what if the issue as @admin said they have updated test cases but still TLE issue is there
Refer to this:
Brute force wil not work now Test cases are updated