My LeetCode grinding. Trying to do a problem a day.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516
  1. class Solution:
  2. def maximum69Number (self, num):
  3. new_num = ""
  4. done = False
  5. for c in str(num):
  6. if c == "6" and not done:
  7. new_num += "9"
  8. done = True
  9. else:
  10. new_num += c
  11. return int(new_num)
  12. s = Solution()
  13. print("Expected: 9999")
  14. print("Got:", str(s.maximum69Number(9699)))