| Total Complexity | 8 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class KthLargestElementInAnArray |
||
| 8 | { |
||
| 9 | public static function findKthLargest(array $nums, int $k): int |
||
| 10 | { |
||
| 11 | if (empty($nums) || $k <= 0) { |
||
| 12 | return 0; |
||
| 13 | } |
||
| 14 | sort($nums); |
||
| 15 | |||
| 16 | return $nums[count($nums) - $k]; |
||
| 17 | } |
||
| 18 | |||
| 19 | public static function findKthLargest2(array $nums, int $k): int |
||
| 33 | } |
||
| 34 | } |
||
| 35 |