Skip to content

Instantly share code, notes, and snippets.

@CodyEngel
Last active August 29, 2015 14:16
Show Gist options
  • Save CodyEngel/3591132fff4998d904e6 to your computer and use it in GitHub Desktop.
Save CodyEngel/3591132fff4998d904e6 to your computer and use it in GitHub Desktop.
Set Duplicate Items to 0
int[] array = {2, 3, 5, 5, 7, 11, 11, 11, 13};
int originalNumber = array[0];
for (int i = 1; i < array.Length; i++)
{
if (array[i] == originalNumber)
{
array[i] = 0;
}
else
{
originalNumber = array[i];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment