Python,why the time is much more shorter when using shuffle?

  • 0
        for each in nums:
        #import random
    		for num in nums:
        		if nums.count(num) > len(nums) / 2:
        			return num
        when i do it without shuffle(),the judging online system says it can't pass an actual 
        problematic case [1]*10000+[2]*10001

Log in to reply

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