일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 개발자
- 영어공부
- 사이드
- 프로젝트
- 매일
- 30분
- Problem Solving
- 파비최
- 화상영어
- 읽기
- leetcode
- 쓰릴오브파이트
- 10분
- 3줄정리
- 잡생각
- 운동
- 만화도
- Writing
- realclass
- 리얼 클래스
- FIT XR
- 괜찮음
- English
- 미드시청
- 월간
- Daily Challenge
- 영어원서읽기
- 링피트
- 뭐든
- 스탭퍼
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/maximum-product-of-word-lengths/
Maximum Product of Word Lengths - 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
n이 그렇게 크지 않아서, 그냥 문제가 원하는대로 풀면 됨.
class Solution:
def maxProduct(self, words: List[str]) -> int:
res = 0
l = len(words)
word = [set(x) for x in words]
for i in range(l-1):
for j in range(i+1, l):
if not word[i] & word[j]:
temp = len(words[i]) * len(words[j])
if res < temp:
res = temp
return res
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.05.31 |
---|---|
Today's Challenge (0) | 2022.05.30 |
Today's Challenge (0) | 2022.05.28 |
Today's Challenge (0) | 2022.05.27 |
Today's Challenge (0) | 2022.05.26 |
Comments