[LeetCode][Python3] 1079. Letter Tile Possibilities
2019. 8. 16. 00:54 |
프로그래밍/LeetCode
Problem :
https://leetcode.com/problems/letter-tile-possibilities/
My Solution :
class Solution:
def numTilePossibilities(self, tiles):
def dfs(prefix, remain):
if prefix not in ans:
ans.add(prefix)
for i in range(len(remain)):
dfs(prefix + remain[i], remain[:i] + remain[i+1:])
ans = set()
dfs('', tiles)
return len(ans)-1
'프로그래밍 > LeetCode' 카테고리의 다른 글
[LeetCode][Python3] 526. Beautiful Arrangement (0) | 2019.08.21 |
---|---|
[LeetCode][Python3] 784. Letter Case Permutation (0) | 2019.08.20 |
[LeetCode][Python3] 980. Unique Paths III (0) | 2019.08.20 |
[LeetCode][Python3] 47. Permutations II (0) | 2019.08.18 |
[LeetCode][Python3] 765. Couples Holding Hands (0) | 2019.08.15 |
[LeetCode][Python3] 854. K-Similar Strings (0) | 2019.08.15 |
[LeetCode][Python3] 5. Longest Palindromic Substring (0) | 2019.04.30 |
[LeetCode][Python3] 140. Word Break II (0) | 2019.04.25 |
최근에 달린 댓글 최근에 달린 댓글