No extra memory except input buffer: O(n log n) time O(n) space (can't do better than this). https://github.com/swagatata/ds_and_algos/blob/master/cpp/trivia/remove_duplicates_without_extra_memory.cpp
If O(1) extra memory is allowed: O(n) time and O(1) space. https://github.com/swagatata/ds_and_algos/blob/master/cpp/trivia/remove_duplicates_one_pass.cpp The code is terse but completely correct. Will leave you guys to figure it out by googling. :) -- DK -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/D9CL-Juk0ycJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
