EPIJudge
EPIJudge copied to clipboard
Unclear on time complexity for nearest repeated entries in array
For the problem "NearestRepeatedEntries", it is mentioned that the solution provided has a time complexity of O(n). I believe this should be O(n*m), where m is the length of longest string among n entries because updating value of a key in hashmap will need to first check for key equality. Please clarify.
Another instance of similar issue in "Remove First-Name Duplicates" "First we sort the array, which brings equal elements together. Sorting can be done in O(n log n) time" This is very incorrect as the time taken will be O(n m log n) where m is the length of longest string. I believe a strict interviewer would give negative points if the time complexity is said to him as O(n log n)
@adnanaziz Please clarify.
Hi @zorro786 ,
I think what you describe is definitely a valid issue for both problems, and this is a very keen observation in my opinion. We would discuss that and let you know that later.