[자바JAVA]Missing Numbers 해커랭크
문제
arr과 brr을 비교하여 brr에는 있지만 arr에는 없는 숫자(Missing Numbers)를 배열로 나타내는 문제.
Given two arrays of integers, find which elements in the second array are missing from the first array.
Function Description : Complete the missingNumbers function in the editor below. It should return a sorted array of missing numbers.
missingNumbers has the following parameter(s):
- int arr[n]: the array with missing numbers
- int brr[m]: the original array of numbers
Returns : int[]: an array of integers
- 입출력예시
1 | //입력 |
코드
두 배열을 각각 HashMap에 담은 뒤 (brr 해쉬맵 - arr 해쉬맵)을 통해 빠진 숫자를 효율적으로 찾을 수 있다.
1 | public class MissingNumbers { |
![[OS/WINDOW]배포후 서버재시작에 batch와 윈도우 스케줄러 활용하기](https://cdn.pixabay.com/photo/2012/03/04/00/50/board-22098_960_720.jpg)
![[블로그]헥소테마에서 댓글기능 facebook에서 utterances로 변경하기](https://miro.medium.com/max/1600/1*aOv6h3h_v9PQWa03zGACnw.png)