Fixed import and formatting of leetcode 17

This commit is contained in:
strNophix 2022-09-03 15:59:02 +02:00
parent 5e3a66aa45
commit fb0684dd27

View File

@ -1,17 +1,20 @@
from typing import List
class Solution: class Solution:
def letterCombinations(self, digits: str) -> List[str]: def letterCombinations(self, digits: str) -> List[str]:
if len(digits) == 0: if len(digits) == 0:
return [] return []
options = { options = {
'2': ('a', 'b', 'c'), "2": ("a", "b", "c"),
'3': ('d', 'e', 'f'), "3": ("d", "e", "f"),
'4': ('g', 'h', 'i'), "4": ("g", "h", "i"),
'5': ('j', 'k', 'l'), "5": ("j", "k", "l"),
'6': ('m', 'n', 'o'), "6": ("m", "n", "o"),
'7': ('p', 'q', 'r', 's'), "7": ("p", "q", "r", "s"),
'8': ('t', 'u', 'v'), "8": ("t", "u", "v"),
'9': ('w', 'x', 'y', 'z') "9": ("w", "x", "y", "z"),
} }
pools = (options[digit] for digit in digits) pools = (options[digit] for digit in digits)