Can anyone tell what is the problem cause I was getting the correct output but in starters 103 contest it was showing wrong.
Do I need to add recursion to it.
for i in range(t):
for j in range(n):
Hi, buddy. Actually, no. The problem is not going to be solved in this way. I solved the same problem. And I explained it right here:
Visit here. There, I explained this problem. I think, that would be helpful))
can you see where is the problem now as I quoted my code
Gotcha, what is wrong with yours. You’re checking for only difference of 1. I mean, your code is just changing one of the characters by 1, which is not match the requirements of the problem. There is a rule that says, if the last 3characters combined is divisible by 8, this number is divisible by 8. For example, 1000 (or 1200, 1800, 1008) is divisible by 8 because 000 is divisible by 8. Didn’t you read my explains that is given in the link I provide? In my opinion, I explained it well there! Read this, that can understand more clear.