Codility:PermCheck

01:34 0 Comments A + a -

image
image
public int solution(int[] A) { // write your code in C# 6.0 with .NET 4.5 (Mono) int N = A.Length; HashSet<int> wzorzecHashSet = new HashSet<int>(); for (int i = 1; i <= N + 1; i++) { wzorzecHashSet.Add(i); } HashSet<int> setA = new HashSet<int>(A); int SetCount = setA.Count; if (setA.SetEquals(wzorzecHashSet)) return 1; else { return 0; } }





https://codility.com/demo/results/trainingAD396N-95S/ .