Implement crawler and bracket validator | Snowflake
|Home/Coding & Algorithms/Snowflake
Implement crawler and bracket validator
Snowflake
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
0
0
Implement two tasks:
(
Write a function crawl(start_urls, fetch, max_depth, domain_filter) that visits pages starting from the given seed URLs using the provided fetch(url) -> (content, outgoing_links) API. Requirements: avoid revisiting URLs (handle cycles), support breadth-first traversal limited by max_depth, enforce domain_filter, and return the set of discovered URLs. Analyze time and space complexity.
(
Design an algorithm to validate whether a string of parentheses is well-formed. Extend it to support three bracket types '()', '[]', and '{}', and return the index of the first error if invalid. Discuss complexity and edge cases (e.g., empty string, odd length, early closing).