← Atlassian Interview Insights
The dedup part was fine, set plus insertion-order tracking, nothing crazy.
Start by clarifying requirements and constraints, then propose a solution using a hash set to track seen URLs while iterating through the list, preserving order. Discuss time/space complexity and edge cases, then outline a testing strategy covering unit, integration, and performance tests.
Pro tip: Mention that using a hash set provides O(1) average lookup, but if memory is a concern, you could sort and deduplicate with a stable sort or use a Bloom filter for approximate deduplication with trade-offs. Also, emphasize the importance of testing with large inputs to catch performance issues.
Ask about input size, memory limits, whether URLs are case-sensitive, and if normalization (e.g., trailing slashes) is needed. Confirm that order must be preserved and that the output should be a list of unique URLs.
Propose iterating through the list once, using a hash set to track seen URLs, and appending unseen URLs to a result list. This preserves first occurrence order and runs in O(n) time and O(n) space.
Compare with sorting-based deduplication (O(n log n) time, O(1) extra space if in-place) or using a Bloom filter for memory-constrained scenarios. Explain why the hash set approach is optimal for most cases.
Cover unit tests for empty list, no duplicates, all duplicates, mixed duplicates, and order preservation. Include integration tests with a mock HTTP client to ensure each URL is fetched exactly once. Add performance tests with large lists.
Address invalid URLs, case sensitivity, URL normalization (e.g., http vs https, trailing slashes), and how to handle fetch failures (e.g., retries, logging) without affecting deduplication.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.