LC0136 - Single Number (EASY)#
This is the solution for Leetcode Problem 136 - Single Number.
1"""Solution to Leetcode 136 - 136
2
3Link : https://leetcode.com/problems/single-number/
4Level: easy
5"""
6from typing import List
7
8
9class Solution:
10 def __init__(self, *args, **kwargs):
11 """Instantiates the solution object"""
12 self.args = args
13 self.kwargs = kwargs
14
15 def solve(self, *args, **kwargs):
16 """This implements the main solution"""
17 raise NotImplementedError("This solution is not yet implemented.")
18
19 def singleNumber(self, nums: List[int]) -> int:
20 result = 0
21 for i in nums:
22 result ^= i
23 return result