MissingInteger【★★★】

 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             int result = 1;
10             Array.Sort(A);
11             foreach (int num in A)
12             {
13                 if (num == result)
14                     result++;
15             }
16             return result;
17         }

 

posted @ 2015-07-25 00:26  叫我霍啊啊啊  阅读(226)  评论(0编辑  收藏  举报