Missing Numbers

Sort by

recency

|

1233 Discussions

|

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/6AXUA5_XwUw

    vector<int> missingNumbers(vector<int> arr, vector<int> brr) {
        map<int, int> mp;
        for(int i = 0; i < brr.size(); i++) mp[brr[i]]++;
        for(int i = 0; i < arr.size(); i++) mp[arr[i]]--;
        map<int, int>::iterator it;
        vector<int> result;
        for(it = mp.begin(); it != mp.end(); it++)
            if(it->second > 0) result.push_back(it->first);
        
        return result;
    }
    
  • + 0 comments

    Promotional products for "Missing Numbers" could include customized planners, notebooks, or branded pens that focus on organization and preparation. A strategic gift like an exclusive "MBA Prep Kit" featuring flashcards or study materials can help emphasize the importance of planning for business school. Personalized USB drives with admission tips or motivational quotes printed on desk accessories would also inspire and assist future applicants on their journey to maximizing chances.

  • + 0 comments
    Java Solution:-
    
    public static List<Integer> missingNumbers(List<Integer> arr, List<Integer> brr) {
        // Write your code here
            // Collections.sort(arr);
            for(int i=0;i<arr.size();i++)
            {``
                brr.remove(arr.get(i));
            }
            Set<Integer> set=new HashSet<>(brr);
            List<Integer> crr=new ArrayList<>(set);
            Collections.sort(crr);
            return crr;
        }
    
  • + 0 comments

    Typescript

    function missingNumbers(arr: number[], brr: number[]): number[] {
        // Write your code here
    
        while (arr.length > 0) {
            if (brr.indexOf(arr[0]) >= 0) {
                const index = brr.indexOf(arr[0])
                brr[index] = undefined
            }
            arr.shift()
        }
        const remaminingSorted = Array.from(new Set(
    	brr
            .filter(n => !isNaN(n))
            .sort((a, b) => a - b)))
            
        return remaminingSorted
    }
    
  • + 0 comments

    C#:

        public static List<int> missingNumbers(List<int> arr, List<int> brr)
    {
        foreach (int number in arr)
        {
            brr.Remove(number);
        }
    
        brr.Sort();
        var hashSet = new HashSet<int>(brr);
    
        return hashSet.ToList();
    }
    

    }