Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test
- {
- public int NotContains(int[] array)
- {
- int count = 0;
- if (array == null) return 1;
- array = array.Where(x => x > 0).OrderBy(x => x).ToArray();
- foreach (var item in array.Length.GetCollection())
- {
- if (array[count++] != item)
- {
- return item;
- }
- }
- return 0;
- }
- }
- static class test2
- {
- public static IEnumerable<int> GetCollection(this int x)
- {
- for (int i = 0; i < x - 1 ; i++)
- {
- yield return i;
- }
- }
- }
Add Comment
Please, Sign In to add comment