Simple python solution


  • 0
    N

    return ([nums[x] for x in range(len(nums)-1) if nums[x] in nums[x+1:] and nums[x] not in nums[:x]])

    It gives me output saying time limit exceeded


Log in to reply
 

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