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