Time, Space and Interviews

function RemoveDups(a: array of integer): integer
{
integer unique_index = 0;
integer current_index = 0;
for (; current_index < a.length; current_index++)
if (is_unique(a[current_index]))
{
remember(a[current_index]);
a[unique_index++] = a[current_index];
}

return unique_index;
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store