這邊引用此篇文章做紀錄
http://bangbingsyb.blogspot.tw/2014/11/clarifying-questions.html
- Array(陣列):
(1) Sorted or not?
是否排序
(2) How many elements?
多少個元素?
(3) Element type? Int, float, double?
元素的型態是? 確認好他是 整數 還是 浮點數 \(4 Byte and 8 Byte\)
型態Reference: http://yhhuang1966.blogspot.tw/2014/03/java\_23.html
(4) What's the range of those numbers? Positive or negative?
數字的範圍以及正負數的確認
(5) Contain duplicates or not?
是否有重複的元素
(6) Subsequence: adjacent or not?
子序列是否相鄰?
- Binary tree(二元樹):
(1) Binary search tree or normal binary tree?
(2) Balanced or not?
(3) Complete or not?
(4) Has parent pointer or not?
- Linked list:
(1) Singly or doubly linked list?
(2) Has duplicated nodal value or not?
- String:
(1) Need to remove white spaces? Tab and newline?
(2) Only has digits? English letters? Upper or lower case?
- 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?
- 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?