alibaba online test

  • 0

    There is a factory which produce goods (A, B, C ...). Product A depends on goods-in-process or raw material (E, F, G...). Goods-in-process E depends on other goods-in-process or raw material (H, I, ...). Now the factory discovers that raw material x has quality issues. As a result all goods-in-process or products that are made of raw material x and other goods-in-process or products that are indirectly produced with x must be destroyed. Please design a data structure to describe the relationship between the raw materials, goods-in-process and products. Your algorithm design must satisfy the following two requests efficiently.

    1. Given a product A, list out all its dependent raw material A - Set.
    2. Given a raw material x that has quality issues, list out all goods-in-process or product that need to be destroyed.

  • 3

    What is B then? You said it is product(produce goods), later you said it is goods-in-process. I am a little confused.

  • 0

    @xidui I guess it's a typo. I have updated the problem description to prevent confusion.

  • 0
    This post is deleted!

  • 0

    The multi linked list will be fine

  • 0

    backGround?how many DataBases?or just two classes (java)to describe this problem?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.