Implement Web Crawler
urls = [
"http://www.yahoo.com"
--> http://basketball.yahoo.com
--> https://www.stackoverflow.com
--> http://politics.yahoo.com
--> http://www.google.com
--> ftp://nexus.com
"http://www.google.com"
--> http://basketball.google.yahoo.com
"http://www.linux.com/"
--> "http://www.example.com/"
"http://us.yahoo.com"
--> http://california.yahoo.com
--> https://www.quora.com
--> http://texas.yahoo.com
--> http://arizona.yahoo.com]
//O(1)
//Consider this this method as already implemented, which will return child of given URL.
//Input - http://www.yahoo.com
//output - [http://basketball.yahoo.com, https://www.stackoverflow.com, http://www.google.com, ftp://nexus.com]
Set getAllUrlsForSingleUrl(String initialUrl);
Implement Below Methods
//Input - InitialURL = http://www.yahoo.com and Domain = yahoo.com
//output - [http://basketball.yahoo.com, http://us.yahoo.com, http://california.yahoo.com, http://arizona.yahoo.com]
Set getAllUrlsForDomain(String initialUrl, String Domain);
boolean isURLMatch(String url, String domain);
//Test-Cases

2nd Round
Question -
You are the head chef for a new restaurant whose menu changes every night. You have a large book of recipes.
and you select a different set of recipes each night based on what you can make from the Raw Ingredients that you get each day.
Each recipe has two sets of inputs; “Intermediate Ingredients” which are the outputs of other recipes and “Raw Ingredients”.
Example recipes:
Bread
Raw Ingredients: Flour, Yeast
Intermediate Ingredients: NONE
Cheese Sandwich
Raw Ingredients: Cheese
Intermediate Ingredients: Bread
Based on a set of recipes and a set of raw ingredients that you have on a given day, can you write an algorithm/code that could calculate the list of possible recipes
that you can put on the menu for the day?