Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- public class Kata
- {
- public static int[] ArrayDiff(int[] a, int[] b)
- {
- // Console.WriteLine(a[0]);
- int[] c = new int[] {};
- int temp = 0;
- int temp2 = 0;
- c=a;
- for (int i=0; i<c.Length; i++)
- {
- temp = c[i];
- for (int j=0; j<b.Length; j++)
- {
- temp2 = b[j];
- if (temp == temp2)
- {
- c = RemoveAt(c, i);
- if (i >= 1)
- { i = 0;
- j --;
- break;}
- // else if (i == 1)
- // else i = 0;
- // break;}
- }
- }
- }
- for (int k = 0; k < c.Length; k++) // debug Stuff
- {
- Console.WriteLine(c[k]);
- }
- Console.WriteLine("");
- // Console.WriteLine(b[0]);
- return c;
- }
- public static int[] RemoveAt(int[] arr, int index)
- {
- for (int f = index; f < arr.Length - 1; f++)
- {
- arr[f] = arr[f + 1];
- }
- if (arr.Length > 0)
- Array.Resize(ref arr, arr.Length - 1);
- return arr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment