PermCheck

 1         /// <summary>
 2         /// Solution
 3         /// 100/100
 4         /// </summary>
 5         /// <param name="A"></param>
 6         /// <returns></returns>
 7         public static int solution(int[] A)
 8         {
 9             HashSet<int> hs = new HashSet<int>();
10             foreach (int num in A)
11             {
12                 if (!hs.Contains(num) && num <= A.Length)
13                     hs.Add(num);
14                 else
15                     return 0;
16             }
17             return 1;
18         }

 

posted @ 2015-07-24 23:33  叫我霍啊啊啊  阅读(143)  评论(0编辑  收藏  举报