You are viewing a single comment's thread. Return to all comments →
filter and lambda together look too confusing. Generator expressions would be much better here. Also, you don't need absolute value. Mod operation should work on negative numbers. Like this:
i,j,k = map(int,input().strip().split())
print(sum((x-int(str(x)[::-1]))%k==0 for x in range(i,j+1)))
Good solution! You're right about negative mod. Wasn't thinking about that. And I'm not super familiar with generator expressions. Your solution has inspired me to look into them more.