일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 잡생각
- English
- 영어원서읽기
- 쓰릴오브파이트
- Daily Challenge
- Problem Solving
- 뭐든
- 파비최
- 화상영어
- 스탭퍼
- 읽기
- 매일
- leetcode
- 리얼 클래스
- Writing
- 괜찮음
- 10분
- 영어공부
- 링피트
- 사이드
- realclass
- 월간
- FIT XR
- 만화도
- 3줄정리
- 프로젝트
- 30분
- 개발자
- 미드시청
- 운동
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