This was more of an OOP-style question, and the problem itself wasn't hard.
You're given two concepts. Recipe stores the dish name, how long it takes, and the ingredients it needs. Supply stores ingredients and their inventory counts. A dish can also appear as an ingredient — for example, one dish in Recipe can be used as an ingredient for another dish.
Based on this, you implement a series of functions, including but not limited to:
add_recipe(name, ingredients, time)
add_supply(raw_ingredient, count)
place_order(dish_name) — based on inventory (e.g., if a dish's required supply is out of stock, it should return true)
a few getters that return specific dishes (e.g., ones that take longer than 20 minutes)
That's roughly the whole problem — just maintain a good class and keep a hashmap of dishes and inventory, and be careful not to write bugs.
It's actually really simple, but I forget why I didn't pass. Probably because I hadn't interviewed in a long time, so at first I spent a lot of time discussing all kinds of edge cases. Really, for this kind of question you should just write the code and be done with it.
From the conversation, it sounded like the company is a bit busy, but the employees still have hope for an IPO — felt pretty optimistic overall.
Discussion
Loading comments…