Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public int findKthLargest(int[] nums, int k) {
- Stack s = new Stack();
- java.util.Arrays.sort(nums);
- int [] array = new int [nums.length];
- for (int i = 0; i < nums.length; i++){
- s.push(nums[i]);
- }
- for (int j = 0; j < nums.length; j++){
- array[j] = (int) s.pop();
- }
- return array[k-1];
- }
- }
Add Comment
Please, Sign In to add comment