简历:The Google Resume: How to Prepare for a Career and Land a Job at Apple, Microsoft, Google, or any Top Tech Company
算法学习书籍:Introduction to Algorithms
编程珠玑:Programming Pearls (2nd Edition)
C++ 学习:The C++ Programming Language, 4th Edition
经典操作系统书籍,龙书:Operating System Concepts
创业:The Start-up of You: Adapt to the Future, Invest in Yourself, and Transform Your Career
Given a collection of numbers, return all possible permutations.
For example,
» Solve this problem[1,2,3]
have the following permutations:[1,2,3]
, [1,3,2]
, [2,1,3]
, [2,3,1]
, [3,1,2]
, and [3,2,1]
.
刚开始想不用递归做,没想出来。后来参考了“水中的鱼” 的解法,用递归,关键点是要存储每一次的permutation,所以用值传递来传递参数,这样就不用把一堆string合并在一起再返回,也节约了运算时间。这类recursion还得多设计,熟练起来。
刷了多少了啊?Q上给你留言了。
ReplyDelete