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 |
Tags
- string
- 파이썬
- Stack
- database
- 자바
- Binary Search
- geometry
- Tree
- greedy
- implement
- 구현
- Data Structure
- Class
- sorting
- array
- Matrix
- simulation
- Number Theory
- Method
- java
- Counting
- bit manipulation
- Math
- hash table
- 코딩테스트
- two pointers
- Binary Tree
- 코테
- SQL
- dynamic programming
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 |