Print Strings without Duplicates
Anonymous User
1231

Give an array A consisting of string with timestamp, and a time-interval T, print the string such that there are no duplications within the time-interval T
Example:
2:foo
3:bar
5:hello
6:foo
11:world
19:foo
and T = 8
Output should be
[foo, bar, hello, world, foo]

Do it in O(N) time and O(N) space complexity.

Comments (5)