Swift solution


  • 0
    class Solution {
        func singleNumber(_ nums: [Int]) -> Int {
            var result = 0
            
            for i in 0..<nums.count {
                result ^= nums[i]
            }
            
            return result
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.