Implement crawler and bracket validator

Quick Overview

This question evaluates competencies in web crawling and string validation, covering graph traversal and cycle avoidance with domain filtering for crawl discovery, and delimiter matching with error indexing for multi-type bracket validation.

Implement crawler and bracket validator

Company: Snowflake

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement two tasks: ( 1) 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. ( 2) 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).

Quick Answer: This question evaluates competencies in web crawling and string validation, covering graph traversal and cycle avoidance with domain filtering for crawl discovery, and delimiter matching with error indexing for multi-type bracket validation.

|Home/Coding & Algorithms/Snowflake
Snowflake logo
Snowflake
Sep 6, 2025, 12:00 AM
mediumSoftware EngineerOnsiteCoding & Algorithms
11
0

Implement two tasks: (

  1. 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. (
  2. 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).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...