k is 0, if so, return nums[0].k is 1, if so, return nums[1] if nums length is greater than 1, otherwise return -1.nums is 1, if so, return nums[0] if k is even, otherwise return -1.k is greater than the length of nums, if so, return the maximum element in nums unless the array has only one element and k is odd.k is equal to the length of nums, if so, return the maximum element among the first k-1 elements.k is less than the length of nums, find the maximum among the first k-1 elements and compare it with the k-th element, returning the greater of the two.