Anyway this code can be made to run faster ?


  • 0
    J
    public class Solution {
        public List<Integer> findDisappearedNumbers(int[] nums) {
    
            List<Integer> originalDigits = new ArrayList<Integer>();
             for(int i = 1; i <= nums.length; i++)
             {
                 originalDigits.add(i);
             }
             for(int i = 0; i < nums.length; i++)
             {
                 originalDigits.remove((Integer)nums[i]);
             }
            
            return originalDigits;
        }
    }
    

Log in to reply
 

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