Skip to content

Commit fe96723

Browse files
committed
算法-题目更正“
1 parent 6da725a commit fe96723

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

MD/算法-数组-快速排序-第k大个数.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
https://leetcode.com/problems/kth-largest-element-in-an-array/
22

3-
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
3+
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.
44

5-
Note:
5+
Example 1:
66

7-
* The number of elements initialized in nums1 and nums2 are m and n respectively.
8-
* You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2.
9-
Example:
107
```
11-
Input:
12-
nums1 = [1,2,3,0,0,0], m = 3
13-
nums2 = [2,5,6], n = 3
8+
Input: [3,2,1,5,6,4] and k = 2
9+
Output: 5
10+
```
11+
12+
Example 2:
1413

15-
Output: [1,2,2,3,5,6]
1614
```
15+
Input: [3,2,3,1,2,4,5,5,6] and k = 4
16+
Output: 4
17+
```
18+
19+
Note:
20+
You may assume k is always valid, 1 ≤ k ≤ array's length.
1721

1822
快排的每一次排序就是找到一个第N大的数,修改快排的递归逻辑。算法复杂度为O(N)。
1923

0 commit comments

Comments
 (0)