题解 | #寻找第K大#
寻找第K大
http://www.nowcoder.com/practice/e016ad9b7f0b45048c58a9f27ba618bf
偷个懒,Python这么强的功能,不用白不用hhhhhhhhh 硬是要写的话,快排完事~
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param a int整型一维数组
# @param n int整型
# @param K int整型
# @return int整型
#
class Solution:
def findKth(self , a: List[int], n: int, K: int) -> int:
# write code here
count = 0
a.sort(reverse=True)
return a[K-1]

网易游戏公司福利 606人发布