| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 영어공부
- 만화도
- 쓰릴오브파이트
- 매일
- 월간
- 개발자
- 프로젝트
- 괜찮음
- realclass
- leetcode
- 사이드
- Daily Challenge
- Problem Solving
- English
- 파비최
- 30분
- 읽기
- 리얼 클래스
- 미드시청
- 3줄정리
- 링피트
- 운동
- 영어원서읽기
- 잡생각
- Writing
- 10분
- 화상영어
- 스탭퍼
- 뭐든
- FIT XR
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.11.16 Today's Challenge 본문
https://leetcode.com/problems/maximum-element-after-decreasing-and-rearranging/
Maximum Element After Decreasing and Rearranging - LeetCode
Can you solve this real interview question? Maximum Element After Decreasing and Rearranging - You are given an array of positive integers arr. Perform some operations (possibly none) on arr so that it satisfies these conditions: * The value of the first e
leetcode.com
Sorting해서 푸는 간단한 문제.
너무 간단해서 문제 이해를 못함 ㅋㅋ
class Solution:
def maximumElementAfterDecrementingAndRearranging(self, arr: List[int]) -> int:
arr.sort()
ans = 1
for i in range(1, len(arr)):
if arr[i] >= ans + 1:
ans += 1
return ans반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| 2023.11.18 Today's Challenge (0) | 2023.11.18 |
|---|---|
| 2023.11.17 Today's Challenge (0) | 2023.11.17 |
| 2023.11.15 Today's Challenge (0) | 2023.11.15 |
| 2023.11.14 Today's Challenge (0) | 2023.11.14 |
| 2023.11.13 Today's Challenge (0) | 2023.11.13 |
Comments