Data Structures definitions at FAANG interview

Huawei
bigmac1

Go to company page Huawei

bigmac1
Mar 19 5 Comments

Many Leetcode questions have definitions of some data structures, for example, Linked List problem have nodes with methods “val” and “next”, Graph nodes have “val”, “left”, “right” methods etc.

My question is, should we build this classes ourself? Or FAANG interviewers already give you this structures?

comments

Want to comment? LOG IN or SIGN UP
TOP 5 Comments
  • New
    Mochaaaa

    New

    Mochaaaa
    You are seriously fucked up!
    Mar 19 1
  • Uber asked me to write the class definition, also asked me to build an example tree to test the code.

    Facebook just asked me to assume a definition.

    It depends on the interviewer, do they want you to assume or not. Because as I wrote the tree in left and right. He changed the definition saying tree is not binary but n-ary.

    My advice is to check with the interviewer..many are testing you how you will code in the production environment. And not that you are a leetcode monkey.

    So ask questions and assumptions before writing code.
    Mar 19 0
  • Amazon / Eng
    SOLORED

    Go to company page Amazon Eng

    SOLORED
    You have to build it yourself unless it’s supported by the standard library like std::list.
    Mar 19 0
  • Meta
    richhea

    Go to company page Meta

    richhea
    It takes more time to talk about it than to write the declaration. Either way, if you are talking about simple struct with no code, it does not really matter, as long as you use it consistently. For example, it should not “grow” a parent member in the middle of your code just because you realize you need it.
    Mar 19 0