Okay, use this:
PHP Code:
getUniqueElements(input, numElements, output, &numUnique)
{
new Trie:set = TrieCreate();
new strKey[12];
for(new i = 0; i < numElements; i++)
{
num_to_str(input[i], strKey, charsmax(strKey));
if(!TrieKeyExists(set, strKey))
{
output[numUnique++] = arr[i];
TriePushCell(set, strKey, 0);
}
}
TrieDestroy(set);
}
Call it like this:
PHP Code:
//assuming you have an array ids you want to process with numIds ids inside it
new uniqueIds[SIZE_HERE]
int numUnique;
getUniqueElements(ids, numIds, uniqueIds, numUnique)
for(int i = 0; i < numUnique; i++)
{
//do something with uniqueIds[i]
}
That's all you need to know to use it. Everything else was just extra information and explanations about why I suggested both solutions.
__________________