题解 | #数组中重复的数字#

数组中重复的数字

http://www.nowcoder.com/practice/6fe361ede7e54db1b84adc81d09d8524

使用临时变量存储

class Solution:
    def duplicate(self , numbers ):
        # write code here
        if len(numbers) == 0:
            return  -1
        temp_list = []
        duplicate_str = ""
        for i in numbers:
            if i not in temp_list:
                temp_list.append(i)
            else:
                duplicate_str = i
                break
        return duplicate_str
全部评论

相关推荐

spiritecs:没实习非985211硕很难很难,只能说祝早日成功
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务