Write a function kthLargest(arr, k), that takes an integer array and integer k, that returns the k-th largest element in the array. Examples: array=[5,-3,9,1] *k=0=>return:9 *k=1=>return:5 *k=3=>return:-3 public int kthLargest(int[] arr, int k) { Array.Reverse(arr); return = arr[k]; }
public ActionResult Arrays(int[] inArr, int k) //find the highest value in the array // ret = arr.Max(); for (int i = 0; i < arr.Length; i++) { if ( inArr[i] > ret) { ret = inArr[i]; } } return View(); }