FORGETPW - Editorial

I am getting .001 only…
You can check on this:

ZtEEzT - Online Java Compiler & Debugging Tool - Ideone.com it is showing runtime error …

the input itself is invalid!!!

Thanks u help me a lot… I’m also getting TLE by this reason…

glad it helped you

The constraint actually states : " All characters in S and ci may be any ASCII printable character except space and pi is a digit (“0” - “9”) or a decimal point “.” "…I’m confused. How’s the input invalid ? Pls elaborate.

CodeChef: Practical coding for everyone please any one find error in my code it runs on all expected test cases but still get wrong answer…

“After all the character replacements, the string is guaranteed to be a positive decimal number”

1 Like

I not have much knowledge of java but I think u are using s.length in loop condition so It increse your complexity to O(s.length^2). so separate calculate s.length and store in local variable and use as condition. For tle may be anY other reason…

@rudra_nitpsarraf ,No one mentioned it because “only” is written i.e, only factional part is present with no integral part… they also showed it using leading examples {(0.5=.5) and (5.0=5)}…

Thanks for answering but as far as I know the length function of a java string is O(1) because java’s string class stores the length as a field.

@dpraveen can u please check for which test cases , it is not working . i m not able to debug any further .

It will show runtime error because you have to enter N not the actual string after number of test cases.

@ PARTNER( :slight_smile: ),If the number contains “only” non-zero fractional part, the integral part should be omitted."
Then THAT “ONLY” itself means that there will be no integral part…isn’t it!!!and if there is no integral part then what is the need of stating to delete integral part!!!

try for n=0 and s=“000000000”
you have not handled this case. It should give answer as 0
try to work on this case too.
good luck…!!!

try for 4 different cases which are mainly important
n=0
s=0.0 ,
n=0
s=00000 ,
n=0
s=0000.120030000 and
n=0
s=0000120000.0000
Still you want any case then try for ‘.’ only
good luck…!!!

if u give ‘space’ instead of n… it fails… how should i correct it?

@pmbhumkar - I’m getting expected result on all those tests: 0, 0, .12003, 0
Any other suggestions? It would really help to see exactly which test cases the code failed on.

This should return 333, right? V5PZ7B - Online C++ Compiler & Debugging Tool - Ideone.com

1 Like

Same situation here. Got 0, 0, .12003, 120000 and 0.But still gives wrong answer in system test.