(This question is a variation of the LeetCode question 215. Kth Largest Element in an Array. If you haven't completed that question yet, it is recommended to solve it first.)
Given an integer array nums and an integer k, return the k largest elements from nums. The result may be returned in any order.
If duplicate values fall within the top k elements, include each occurrence separately.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected