problem
Getting tle
my solution
Change
st=st+"1";
to
st+="1";
and the same for "0"
. The former creates a whole new copy of st
; appends 1
to it; and re-assigns it to st
, making this an O(|s|^2) operation when performed over the whole of s
.
I don’t think function will work Bin_to_Dec.
|s|<=10^5
Consider the test input:
1
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
giving answer
-291172004
Yes, I know
what i do now
-
Use the test input I gave you to diagnose the problem.
-
Fix the problem
yes
i have done if(max<0) then max=0;
but till giving wa
I have check one corect solution and giving 291172004
to your input
I have correct answer for your input not getting ac
Consider the test input:
1
abbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
please help me
See what is the largest number you can store in dec_value
i cannot get what you mean
Take example when string length is 70 and see what is stored in dec_value. Try printing the value before taking its mod. You will know then. Take this case
1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
value is -1