Skip to content

Commit 09a990b

Browse files
committed
Algorithm solving problem "136. Single Number" from Leetcode (https://leetcode.com/problems/single-number/)
1 parent 2fec97b commit 09a990b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: bit_manipulation/single_number.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Given a non-empty array of integers nums, every element
3-
appears twice except for one. Find that single one.
3+
appears twice except for one. Find that single one
44
55
You must implement a solution with a linear runtime complexity
66
and use only constant extra space.
@@ -14,6 +14,17 @@ def single_number(nums: list) -> int:
1414
:param nums: A non-empty array of any integers nums,
1515
every element appears twice except for one.
1616
:return: element that appears only one time
17+
18+
Examples:
19+
Example 1
20+
Input: nums = [1, 3, 3, 2, 6, 2, 1]
21+
Output: 6
22+
Example 2
23+
Input: nums = [12, 1, 1, 7, 1, 12, 1]
24+
Output: 7
25+
Example 3
26+
Input: nums = [6]
27+
Output: 6
1728
"""
1829
result = 0
1930

0 commit comments

Comments
 (0)