题解 | 数组中只出现一次的两个数字

数组中只出现一次的两个数字

https://www.nowcoder.com/practice/389fc1c3d3be4479a154f63f495abff8

#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param nums int整型一维数组 
# @return int整型一维数组
#
class Solution:
    def FindNumsAppearOnce(self , nums: List[int]) -> List[int]:
        # write code here
        arr = []
        for i in range (0,len(nums)-1):
            for j in range (i+1,len(nums)):
                if nums[i] == nums[j] :
                   arr.append(nums[i])
                   arr.append(nums[j])
        result = [item for item in nums if item not in arr]
        result.sort()  
        return result

全部评论
考虑南京OD的宝子们看过来,你就是我们要找的人,一对一指导,可私信
点赞 回复 分享
发布于 2025-08-09 17:27 贵州

相关推荐

LastWh1spe...:ssob真有些人和那个没睡醒一样
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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