Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit706b18d

Browse files
refactor 215
1 parentd4c42f7 commit706b18d

File tree

1 file changed

+4
-15
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+4
-15
lines changed

‎src/main/java/com/fishercoder/solutions/_215.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44
importjava.util.Collections;
55
importjava.util.PriorityQueue;
66

7-
/**
8-
* 215. Kth Largest Element in an Array
9-
*
10-
* Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
11-
12-
For example,
13-
Given [3,2,1,5,6,4] and k = 2, return 5.
14-
15-
Note:
16-
You may assume k is always valid, 1 ≤ k ≤ array's length.
17-
18-
*/
197
publicclass_215 {
208

219
publicstaticclassSolution1 {
@@ -39,10 +27,11 @@ public int findKthLargest(int[] nums, int k) {
3927
}
4028

4129
publicstaticclassSolution3 {
42-
/**Quick Select algorithm
30+
/**
31+
* Quick Select algorithm
4332
* Time: O(n) in average, O(n^2) in worst case
44-
*
45-
* Reference: https://discuss.leetcode.com/topic/14611/java-quick-select*/
33+
*Reference: https://discuss.leetcode.com/topic/14611/java-quick-select
34+
*/
4635
publicintfindKthLargest(int[]nums,intk) {
4736
intstart =0;
4837
intend =nums.length -1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp