[ LeetCode ] 819번 Most Common Word

2021. 4. 18. 16:06·Archive/Develop
728x90
반응형

leetcode.com/problems/most-common-word/

 

Most Common Word - 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 mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
        #data cleansing
        words = [word for word in re.sub('[^\w]',' ',paragraph).lower().split() if word not in banned]
        
        counts = collections.Counter(words)
        return counts.most_common(1)[0][0]

 

 

 

 

728x90
반응형

'Archive > Develop' 카테고리의 다른 글

[ GitHub ] Build Docker Image with Private Repo  (0) 2021.04.24
[ LeetCode ] 49번 Group Anagrams  (0) 2021.04.19
[ LeetCode ] 937번 Reorder Data in Log Files 풀이  (0) 2021.04.16
[ LeetCode ] 344번 Reverse String  (0) 2021.04.15
[ Leetcode ] 125번 Valid Palindrome 풀이  (0) 2021.04.15
'Archive/Develop' 카테고리의 다른 글
  • [ GitHub ] Build Docker Image with Private Repo
  • [ LeetCode ] 49번 Group Anagrams
  • [ LeetCode ] 937번 Reorder Data in Log Files 풀이
  • [ LeetCode ] 344번 Reverse String
코뮤(commu)
코뮤(commu)
코딩으로 커뮤니케이션하는 코뮤입니다 😎
  • 코뮤(commu)
    코뮤(COMMU)
    코뮤(commu)
  • 전체
    오늘
    어제
    • 분류 전체보기
      • Archive
        • Hacking
        • Develop
        • ETC
      • Algorithm
      • DB&Infra
      • ETC
      • Node
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • IT지식보따리
    • IT가 맛있다
    • IT 천재
  • 공지사항

    • 배고픕니다
  • 인기 글

  • 태그

    자바스크립트 객체
    카카오 100일 프로젝트
    파이썬 알고리즘
    파이썬 기초 문제
    docker
    백준
    오라클
    백준 파이썬
    Python
    Oracle
    보안뉴스
    파이썬 기초
    코드업 기초
    파이썬 백준
    장고
    자바스크립트 API
    파이썬 문제
    자바스크립트
    Django
    백준 풀이
    코드업
    백준 문제풀이
    파이썬
    Codeup
    oracle db
    C++
    코드업 파이썬 기초 100제
    javascript
    Git
    비박스
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.1
코뮤(commu)
[ LeetCode ] 819번 Most Common Word
상단으로

티스토리툴바