일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 운동
- English
- 스탭퍼
- 10분
- 30분
- 영어공부
- 프로젝트
- 뭐든
- 영어원서읽기
- FIT XR
- 월간
- 괜찮음
- Writing
- 읽기
- 미드시청
- 잡생각
- 리얼 클래스
- 3줄정리
- 화상영어
- realclass
- leetcode
- Problem Solving
- 만화도
- 매일
- 개발자
- 사이드
- Daily Challenge
- 링피트
- 파비최
- 쓰릴오브파이트
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.09.19 Today's Challenge 본문
https://leetcode.com/problems/find-the-duplicate-number/
LeetCode - The World's Leading Online Programming Learning Platform
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 findDuplicate(self, nums: List[int]) -> int:
nums.sort()
before = -1
for num in nums:
if before == num:
return num
before = num
return -1
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.09.21 Today's Challenge (0) | 2023.09.21 |
---|---|
2023.09.20 Today's Challenge (0) | 2023.09.20 |
2023.09.18 Today's Challenge (0) | 2023.09.18 |
2023.09.17 Today's Challenge (0) | 2023.09.17 |
2023.09.16 Today's Challenge (0) | 2023.09.16 |
Comments