Guest User

Untitled

a guest
Dec 14th, 2019
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution:
  2. def sequentialDigits(self, low: int, high: int) -> List[int]:
  3.  
  4. ans_list = []
  5. digit_range = range(len(str(low)),len(str(high))+1)
  6.  
  7. for dr in digit_range:
  8. for i in range(1,11-dr):
  9. d = [str(x) for x in range(i,i+dr)]
  10. s = "".join(d)
  11. no = int(s)
  12. if no>=low and no<=high:
  13. ans_list.append(no)
  14.  
  15. return ans_list
RAW Paste Data