| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 미드시청
- 스탭퍼
- FIT XR
- 10분
- Problem Solving
- leetcode
- 프로젝트
- 뭐든
- 사이드
- 영어원서읽기
- 만화도
- 링피트
- 화상영어
- 월간
- 쓰릴오브파이트
- 30분
- realclass
- 파비최
- 운동
- 잡생각
- 개발자
- 매일
- Writing
- Daily Challenge
- 영어공부
- 리얼 클래스
- 읽기
- 3줄정리
- English
- 괜찮음
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.12.11 Today's Challenge 본문
https://leetcode.com/problems/element-appearing-more-than-25-in-sorted-array/
Element Appearing More Than 25% In Sorted Array - LeetCode
Can you solve this real interview question? Element Appearing More Than 25% In Sorted Array - Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer. Ex
leetcode.com
생각할 거리가 조금은 있는 문제
class Solution:
def findSpecialInteger(self, arr: List[int]) -> int:
size = len(arr) // 4
for i in range(len(arr) - size):
if arr[i] == arr[i + size]:
return arr[i]
return -1반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| 2023.12.13 Today's Challenge (0) | 2023.12.13 |
|---|---|
| 2023.12.12 Today's Challenge (0) | 2023.12.12 |
| 2023.12.10 Today's Challenge (0) | 2023.12.10 |
| 2023.12.09 Today's Challenge (0) | 2023.12.09 |
| 2023.12.08 Today's Challenge (0) | 2023.12.08 |
Comments