Website Summary Files Commits Branches @commit @diff @stats
path: root / pract_SI / Pract. 05 / Solutions / task1.cpp
blob: 3a3a2c8721906ffd2f80c678fbabb2e8ed56a8f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
int firstDuplicateInArray(const int *arr, int size)
{
	for (int i = 0; i < size - 1; i++)
	{
		for (int j = i + 1; j < size; j++)
		{
			if (arr[i] == arr[j])
				return arr[i];
		}
	}
	
	return -1;
}