上一页 1 ··· 3 4 5 6 7
摘要: 泛型算法之 replace_copy()函数 如下代码 int main() { vector<int> a, b; for(int i = 0; i != 10; ++i) a.push_back(i); replace_copy(a.cbegin(), a.cend(), back_insert 阅读全文
posted @ 2017-06-28 19:26 bloomingFlower 阅读(108) 评论(0) 推荐(0) 编辑
摘要: c++最终版 class Solution {public: int firstMissingPositive(vector<int>& nums) { int n = nums.size(); for (int i = 0; i < n; i++) while (nums[i] > 0 && nu 阅读全文
posted @ 2017-06-12 01:19 bloomingFlower 阅读(112) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int[] twoSum(int[] numbers, int target) { Map<Integer, Integer> map = new HashMap<Integer, Integer>(); int[] results = 阅读全文
posted @ 2017-05-03 00:23 bloomingFlower 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 大写转小写:return str - 'A' + 'a'; 数字转字符串: return num - 48; 阅读全文
posted @ 2017-05-02 22:07 bloomingFlower 阅读(1358) 评论(0) 推荐(0) 编辑
摘要: 暴力解法O(n2) 略 —————————————————————————————— java中map的get时间为O(1) C++中为O(logn) 哈希解法第一版 O(n) public class Solution {public int[] twoSum(int[] nums, int ta 阅读全文
posted @ 2017-04-30 16:14 bloomingFlower 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 我的做法 time : O(N2) public class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2]; int i = 0, j = 0; for (; i < nums.l 阅读全文
posted @ 2017-04-28 14:49 bloomingFlower 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 17.4.25 WRONG ANSWERS public class Solution { public int nthSuperUglyNumber(int n, int[] primes) { int len = primes.length; int[] pw = new int[len];// 阅读全文
posted @ 2017-04-25 21:28 bloomingFlower 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 不去重错误版 17.4.23 long isMin (long a, long b) { if (a >= b) a = b; return a;}long nthUglyNumber(long n) { long *l = (long*)malloc(n*sizeof(long)); for (l 阅读全文
posted @ 2017-04-23 20:21 bloomingFlower 阅读(145) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7