2017年5月2日
摘要: 如果把setiosflags(ios::fixed)放到最前面,则都会受其影响。 阅读全文
posted @ 2017-05-02 10:10 无惧风云 阅读(1093) 评论(0) 推荐(0)
摘要: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2017-05-02 08:06 无惧风云 阅读(117) 评论(0) 推荐(0)
  2017年4月28日
摘要: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2017-04-28 15:55 无惧风云 阅读(150) 评论(0) 推荐(0)
摘要: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil 阅读全文
posted @ 2017-04-28 15:31 无惧风云 阅读(155) 评论(0) 推荐(0)
  2017年4月27日
摘要: 1 #include 2 using namespace std; 3 int func1(unsigned int i) { 4 5 unsigned int temp = i; 6 7 temp = (temp & 0x55555555) + ((temp & 0xaaaaaaaa) >> 1); 8 9 temp = (temp & 0x33... 阅读全文
posted @ 2017-04-27 14:41 无惧风云 阅读(195) 评论(0) 推荐(0)
  2017年4月25日
摘要: 方法二:插入的不同方法 阅读全文
posted @ 2017-04-25 10:27 无惧风云 阅读(4049) 评论(0) 推荐(0)
  2017年4月24日
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2017-04-24 11:40 无惧风云 阅读(160) 评论(0) 推荐(0)
摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-04-24 11:09 无惧风云 阅读(150) 评论(0) 推荐(0)
摘要: #include #include using namespace std; struct s1 { char a[8]; }; struct s2 { double d; }; struct s3 { s1 s; char a; }; struct s4 { s2 s; char a; }; struct s5 { int i : 8; int j : 4; int a... 阅读全文
posted @ 2017-04-24 10:18 无惧风云 阅读(336) 评论(0) 推荐(0)
  2017年4月22日
摘要: Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at 阅读全文
posted @ 2017-04-22 14:10 无惧风云 阅读(188) 评论(0) 推荐(0)