I understand you’re new here. Please take care while pasting codes/linking submissions. Go through posts telling you about features of CC Discuss and then create a new post. Also, humble suggestion please keep the topic short
The link you have share leads to the submit page, not your submission. Your submission can be linked from
Be careful in the case where N < 10. Here the first and last digits are the same and doing this will lead to a wrong answer. Take care of this edge case separately
Thank you so much sir
I am really so much happy that you have responded on my post and sharing your ideas.
And it’s really helpful for me.I will remember everything from next time that you have told.
Hey,I added this condition to my original code after I had submitted once, as when N is,say 5, then N[0] and N[-1] will be same, as the first and last index is same(the only index, in this case) .
So the output will be twice of what is expected i think, but the problem has pretty weak testcases because it gave me AC even without this condition
Or maybe that is the answer they wanted? Like for N = 5, expected output could be 10 instead of 5, cause in this case the first and the last digit are both 5 (as seen in above pic) so maybe they were expecting us to add 5 twice…
CONSTRAINTS ARE GIVEN TO GIVE YOU A HINT OF TIME COMPLEXITY. IT IS ‘GUARANTEED’ THAT THE TEST CASES WILL BE WITHIN THESE TEST CASES. YOU DO NOT NEED A CONDITION TO CHECK THIS
may be test cases were updated between @anon11076894 submission and your submission, and for single digit numbers (len(l)==1) both first and last digits are same, so answer should be 2*number.
but this is not possible, because I had submitted the code (with condition of len(string) == 1 once before him also, and it gave me WA. Also, our recent submission was not very far apart, and since this is a fairly old problem of practice beginner, i hardly think they’ll be changing anything rn
He submitted in 2019, and you in 2020, but this questions has submissions from 2015, so i also don’t think that they would have changed anything after 4 years.