-
Lesson4. Counting Elements - PermCheckAlgorithm/codility 2018. 7. 23. 16:04
PermCheck - Check whether array A is a permutation.
https://app.codility.com/programmers/lessons/4-counting_elements/perm_check/
문제요약
N개의 정수 배열 A가 있을 때, 1부터 N까지 한 번씩 나오면 permutation이라고 한다. A가 permutation이면 1, 아니면 0을 반환Assume that:
N is an integer within the range [1..100,000];
each element of array A is an integer within the range [1..1,000,000,000].
Complexity:
expected worst-case time complexity is O(N);
expected worst-case space complexity is O(N) (not counting the storage required for input arguments).
풀이