[LeetCode]Single Number III | 书影博客
Given nums = [1, 2, 1, 3, 2, 5], return [3, 5].
Note:
The order of the result is not important. So in the above example, [5, 3] is also correct.
Your algorithm should run in linear runtime complexity. Could you implement it using only constant space complexity?
题目大意:
给定一个整数数组,其中除两个数字只出现一次外,其余数字均出现两次。找出这两个只出现一次的数字。
例如:
给定 nums = [1, 2, 1, 3, 2, 5],返回 [3, 5]
注意:
结果的顺序不重要。因此在上例中,[5, 3]也是正确的。
你的算法应该满足线性时间复杂度。你可以只使用常数空间复杂度完成题目吗?
Read full article from [LeetCode]Single Number III | 书影博客
No comments:
Post a Comment