Hello all, this is my first post here.
I am using the list comprehension.
class Solution(object): def singleNonDuplicate(self, nums): return [nums[i] for i in range(len(nums)) if nums.count(nums[i]) < 2]
Hi, I am wondering the time complexity of sum(nums), I know this solution can be accepted, but the time complexity should be O(n), while the requirement is O(logn). Also, the time and space complexities of set(nums) are also larger than O(logn) and O(1).
@clemsonc expected solution should be O(logn)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.