일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 영어공부
- 뭐든
- 프로젝트
- Problem Solving
- 쓰릴오브파이트
- 3줄정리
- 잡생각
- 읽기
- 매일
- 영어원서읽기
- FIT XR
- English
- 사이드
- 스탭퍼
- 리얼 클래스
- 개발자
- realclass
- 10분
- 30분
- 링피트
- 파비최
- 운동
- 화상영어
- 미드시청
- leetcode
- Daily Challenge
- 괜찮음
- Writing
- 월간
- 만화도
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/
Maximum Length of a Concatenated String with Unique Characters - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
유니크한 텍스트들을 찾아서 가장 긴 거를 리턴하면 됨.
class Solution:
def maxLength(self, arr: List[str]) -> int:
uniq = []
for s in arr:
u = set(s)
if len(u) == len(s):
uniq.append(u)
cc = [set()]
for u in uniq:
for c in cc:
if not c & u:
cc.append(c|u)
return max(len(ccc) for ccc in cc)
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.10.26 |
---|---|
Today's Challenge (0) | 2022.10.25 |
Today's Challenge (0) | 2022.10.23 |
Today's Challenge (0) | 2022.10.22 |
Today's Challenge (0) | 2022.10.21 |
Comments