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

数组中重复的数字

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
全部评论

相关推荐

码农顶针:估计让你免费辅导老板孩子的学习
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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