题解 | #有序数组中出现一次的元素#

有序数组中出现一次的元素

http://www.nowcoder.com/practice/4c67fc80c37649ac906fee76ec82beb4

计数后排序

#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param v int整型一维数组 
# @return int整型
#
from collections import Counter
class Solution:
    def singleElement(self , v: List[int]) -> int:
        # write code here
        return sorted(Counter(v).items(), key=lambda x:x[1])[0][0]
全部评论

相关推荐

不知道怎么取名字_:玩游戏都写到简历上了啊
投递BOSS直聘等公司6个岗位
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务