Missing Numbers

  • + 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
    }