会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
PirateLHX
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
9
10
下一页
2017年10月29日
LeetCode--Valid PalindromeⅡ
摘要: 正常解法 以上是正常解法,但认真分析可以发现其复杂度是O(n^2),原因很简单,首先先逐个查找去掉某一个字符的字符串是不是回文序列,查找需要n次,同时字符串与reverse后字符串的比较的次数也为n次,由此可见算法复杂度是n^2,这在leetcode上运行时会出现严重的超时,故采取第二种简单的做法,
阅读全文
posted @ 2017-10-29 13:38 PirateLHX
阅读(189)
评论(4)
推荐(0)
2017年9月23日
1. Two Sum
摘要: class Solution { public: //int compare(const void * arg1, const void *arg2) //{ //return (*(int*)arg1 - *(int*)arg2); //} vector twoSum(vector& nums, int target) { vector res; vector...
阅读全文
posted @ 2017-09-23 23:37 PirateLHX
阅读(95)
评论(0)
推荐(0)
2017年9月22日
0-1背包问题详解1(伪背包问题)
摘要: 题目:给出一个数组,将其分为两份,使得这两份差值最小。 解答: 比如a={4,3,2,1},其实只要让其逼近sum(a)/2即可,所以可以等效于一个背包容量为5,从a中取出若干件物品,将其装满,但是这样会出现问题,就是4+1,3+1都符合条件,(如果我们假设他们价值为1的话,受网上误导很大),事实上
阅读全文
posted @ 2017-09-22 12:27 PirateLHX
阅读(301)
评论(0)
推荐(0)
2017年9月21日
树的遍历
摘要: #include #include #include #include using namespace std; char* res[26]; struct Node { Node* left; Node* right; char num; Node() { }; Node(char c, Node* l = N...
阅读全文
posted @ 2017-09-21 23:36 PirateLHX
阅读(133)
评论(0)
推荐(0)
2017年9月20日
简单马周游问题1152siicly
摘要: 典型DFS问题 注意每次新的寻迹都要重新初始化 DFS路径不成功要将路径的标记去掉 记得return,递归 #include<iostream> #include<memory.h> using namespace std; int result[30]; int a[5][6]; int flag
阅读全文
posted @ 2017-09-20 16:34 PirateLHX
阅读(234)
评论(0)
推荐(0)
2017年9月19日
Sicily 1155. Can I Post the lette
摘要: 思路:深度搜索每个城市是否存在道路,并用一个数组保存访问记录,识别能不能到达终点。
阅读全文
posted @ 2017-09-19 22:55 PirateLHX
阅读(192)
评论(0)
推荐(0)
2017年9月13日
POJ 1007
摘要: #include #include #include #include #include using namespace std; int cmp(int a,int b){ return a>len; cin>>number; int* a=new int[number]; for(int i=0;i>DNA; dnalist[i].dna=DNA; measur...
阅读全文
posted @ 2017-09-13 20:21 PirateLHX
阅读(110)
评论(0)
推荐(0)
2017年9月4日
给定2个大小分别为n, m的整数集合,分别存放在两个数组中 int A[n],B[m],输出两个集合的交集。
摘要: http://blog.csdn.net/mhxy199288/article/details/37766679
阅读全文
posted @ 2017-09-04 11:42 PirateLHX
阅读(592)
评论(0)
推荐(0)
算法1--
摘要: 有两个数组a,b,大小都为n,数组元素的值任意,无序;通过交换a,b中的元素,使数组a元素的和与数组b元素的和之间的差最小。 C++:http://blog.csdn.net/cwqbuptcwqbupt/article/details/7521733 python:http://www.iteye
阅读全文
posted @ 2017-09-04 11:24 PirateLHX
阅读(135)
评论(0)
推荐(0)
2017年9月1日
GAN
摘要: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import numpy as np from skimage.io import imsave import os import shutil img_height = 28 img_width = 28 img_size = ...
阅读全文
posted @ 2017-09-01 16:58 PirateLHX
阅读(322)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
10
下一页
公告