leetcode

Leetcode submissions
git clone git://git.laack.co/leetcode.git
Log | Files | Refs | README

find-the-k-th-character-in-string-game-iV1.py (316B)


      1 class Solution:
      2     def kthCharacter(self, k: int) -> str:
      3         word = "a"
      4         while len(word) <= k:
      5             word += increment_word(word)
      6         return word[k - 1]
      7 
      8 
      9 def increment_word(word):
     10     new_word = ""
     11     for char in word:
     12         new_word += chr((ord(char) - 96) % 26 + 97)
     13     return new_word