标签:color arrays string str turn import [] return nbsp
import java.util.Arrays; public class Lint5 { /* * 第k大的元素 */ public static void main(String[] args) { int[] nums = new int[] {1,4,5,6,2}; System.out.println(kthLargestElement(2, nums)); } public static int kthLargestElement(int n, int[] nums) { n --; Arrays.sort(nums); return nums[nums.length-n-1]; } }
标签:color arrays string str turn import [] return nbsp
原文地址:https://www.cnblogs.com/cnmoti/p/10817090.html