Questions should be clarified when being interviewed

There are some questions should be clarified when being interviewed. Make sure to communicate with the interviewer and understand the question clearly.

  1. Array:
    (1) Sorted or not?
    (2) How many elements?
    (3) Element type? Int, float, double?
    (4) What’s the range of those numbers? Positive or negative?
    (5) Contain duplicates or not?
    (6) Subsequence: adjacent or not?

  2. Binary tree:
    (1) Binary search tree or normal binary tree?
    (2) Balanced or not?
    (3) Complete or not?
    (4) Has parent pointer or not?

  3. Linked list:
    (1) Singly or doubly linked list?
    (2) Has duplicated nodal value or not?

  4. String:
    (1) Need to remove white spaces? Tab and newline?
    (2) Only has digits? English letters? Upper or lower case?

  5. Graph:
    (1) How many nodes and edges?
    (2) Directed or undirected?
    (3) Edges have weights? If so, what’s the range?
    (4) Has loops? Negative sum loops?

  6. Return value:
    (1) What should my method return?
    (2) If there are multiple solutions to the problem, which one should be returned?
    (3) If it should return multiple values, do you have any preference on what to return?
    (4) What should I do/return if the input is invalid / does not match the constraints?