简历: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 that might contain duplicates, return all possible unique permutations.
For example,
» Solve this problem[1,1,2]
have the following unique permutations:[1,1,2]
, [1,2,1]
, and [2,1,1]
.
关键就是去掉重复的。 我的方法是用hashtable, unordered_map<vector<int>, bool> hm;
遇到一个在hashmap里没有的,我就insert一个,每次遇到一个permutation我都检查一下hashmap里面有了木有。可惜俺不会specialize hash,搞了半天,网上找了几个都不work out,我对这个不熟,因为vector<int> 不是hashmap已有的参数。于是还是参照了 别人的code。求大神告诉我肿么 specialize....
No comments:
Post a Comment