Thank you! I will be aware of nested variables like that. I see the issue 
with substr() too: it was lopping off more than just the first element in 
some cases. Thanks for that. The code passes Test set 1 and 2 now. It gives 
a WA on Test Set 3. Thoughts?

On Monday, April 13, 2020 at 4:52:51 PM UTC-4, porker2008 wrote:
>
> your trim function is not working properly.
>
> To fix it, you can try
>
> *string trim(string bstring) {*
> * for (int i = 0; i < 1000; ++i) {*
> * if (bstring[0] == '0') bstring = bstring.substr(1);*
> * else return bstring;*
> * }*
> * return bstring;*
> *}*
>
> Also you have nested loop reusing loop variable *i*, though it does not 
> affect the correctness, it is not a good pattern.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/36e5cb0c-6f58-4ab2-b92e-83902ec2112c%40googlegroups.com.

Reply via email to