Time Limit Exceeded ?? java

  • 0
    public class Solution {
        public boolean containsDuplicate(int[] nums) {
             Set<Integer> set = new HashSet<>();
             for(int num : nums)
             return set.size() != nums.length;

    This is my solution.Sometimes accepted,sometimes Time Limit Exceeded??

  • 0

    @a2950240 I got TLE the first time submitted, when I try again, I got AC, it is possibly due to the load of the judge system

Log in to reply

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