1236.Web-Crawler
1236. Web Crawler
题目地址
https://leetcode.com/problems/web-crawler/
题目描述
Given a url startUrl and an interface HtmlParser, implement a web crawler to crawl all links that are under the same hostname as startUrl.
Return all urls obtained by your web crawler in any order.
Your crawler should:
Start from the page: startUrl
Call HtmlParser.getUrls(url) to get all urls from a webpage of given url.
Do not crawl the same link twice.
Explore only the links that are under the same hostname as startUrl.代码
Approach 1: BFS
Last updated
Was this helpful?