Foreword
To be continued…
General Questions
Q1. What is the time complexity of adding an element into a set in Python?
Q2. meta_class in Python?
Q3. Python协程?
Q4. Python多继承?
Q5. Python与Java差异?
Q6. Flask是同步还是异步框架?
Q7. 服务器与客户端请求:单向 or 双向?
Q8. 单例模式
Q9. 进程与线程
Q10. 死锁与互斥
Q11. Redis机制与好处
Q12. 接口优点
Q13. HTTP 状态码
Q14. TCP连接/断开连接的机制与过程
Q15. 继承与组合比较
Q16.
Coding Questions
Q1. Two Sum
(Source) Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.
Example:
Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].
UPDATE (2016/2/13):
The return format had been changed to zero-based indices. Please read the above updated description carefully.
Q2. Word Ladder
(Source) Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
- Only one letter can be changed at a time
- Each intermediate word must exist in the word list
For example,
Given:
beginWord = “hit”
endWord = “cog”
wordList = [“hot”,”dot”,”dog”,”lot”,”log”]
As one shortest transformation is “hit” -> “hot” -> “dot” -> “dog” -> “cog”,
return its length 5.
Note:
- Return 0 if there is no such transformation sequence.
- All words have the same length.
- All words contain only lowercase alphabetic characters.
Q3. Word Ladder II
(Source) Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:
- Only one letter can be changed at a time
- Each intermediate word must exist in the word list
For example,
Given:
beginWord = “hit”
endWord = “cog”
wordList = [“hot”,”dot”,”dog”,”lot”,”log”]
Return
[ ["hit","hot","dot","dog","cog"], ["hit","hot","lot","log","cog"] ]
Note:
- All words have the same length.
- All words contain only lowercase alphabetic characters.
Q4. Shortest Word Distance
(LeetCode) Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.
For example,
Assume that words = ["practice", "makes", "perfect", "coding", "makes"]. Given word1 = “coding”, word2 = “practice”, return 3. Given word1 = "makes", word2 = "coding", return 1.
Note:
You may assume that word1 does not equal to word2, and word1 and word2 are both in the list.
Links:
(1) http://www.cnblogs.com/sherylwang/p/5833379.html
Q5. Shortest Word Distance II
(LeetCode)
Q6. Shortest Word Distance III
(LeetCode)