Guest User

Untitled

a guest
Sep 26th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Solution {
  2. public int findKthLargest(int[] nums, int k) {
  3. Stack s = new Stack();
  4. java.util.Arrays.sort(nums);
  5. int [] array = new int [nums.length];
  6.  
  7. for (int i = 0; i < nums.length; i++){
  8. s.push(nums[i]);
  9. }
  10.  
  11. for (int j = 0; j < nums.length; j++){
  12. array[j] = (int) s.pop();
  13. }
  14.  
  15. return array[k-1];
  16. }
  17. }
Add Comment
Please, Sign In to add comment