You are viewing a single comment's thread. Return to all comments →
def beautifulDays(i, j, k): count = 0 for r in range(i,j+1): str1 = str(r) rev_str = str1[::-1] rev_num = int(rev_str) diff = abs(r-rev_num) num = diff/k num1 = diff//k if num == num1: count += 1 return count
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
def beautifulDays(i, j, k): count = 0 for r in range(i,j+1): str1 = str(r) rev_str = str1[::-1] rev_num = int(rev_str) diff = abs(r-rev_num) num = diff/k num1 = diff//k if num == num1: count += 1 return count