Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- greedy
- Binary Search
- 코딩테스트
- Class
- java
- Matrix
- 코테
- database
- sorting
- implement
- 구현
- two pointers
- dynamic programming
- Data Structure
- Number Theory
- Binary Tree
- Method
- simulation
- bit manipulation
- Math
- Stack
- hash table
- 파이썬
- Tree
- geometry
- string
- array
- SQL
- Counting
- 자바
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Medium] 215. Kth Largest Element in an Array 본문
1. Input
1) 정수 배열 nums
2) 정수 k
2. Output
1) nums에서 k번째로 큰 요소를 반환
3. Constraint
1) 1 <= k <= nums.length <= 10^5
2) - 10^4 <= nums[i] <= 10^4
4. Example
Input: nums = [3,2,1,5,6,4], k = 2 -> Output: 5
5. Code
1) 첫 코드(2022/06/22)
Arrays.sort(nums);
return nums[nums.length-k];
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[LeetCode/Easy] 551. Student Attendance Record I (0) | 2022.12.26 |
---|---|
[LeetCode/Medium] 28. Find the Index of the First Occurrence in a String (0) | 2022.12.26 |
[LeetCode/Easy] 1491. Average Salary Excluding the Minimum and Maximum Salary (0) | 2022.12.26 |
[LeetCode/Easy] 1486. XOR Operation in an Array (0) | 2022.12.26 |
[LeetCode/Easy] 1480. Running Sum of 1d Array (0) | 2022.12.26 |