题目:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2...
分类:
其他好文 时间:
2014-09-22 20:55:03
阅读次数:
203
题目:给定一个string,找出第一个string里的unique character,如“cisco”的话就应该是i,“cat”的话就是c。
第一种方法是用LinkedHashMap保留数据的顺序,过一遍string,对字符进行计数,然后找到第一个数量为1的字符即可。
第二种方法是用一个HashSet来存已经重复的字符,然后用个arraylist来存仅出现了一次的字符。
第三种方法是用Ha...
分类:
其他好文 时间:
2014-09-21 09:11:30
阅读次数:
293
一、key与primary key区别CREATE TABLE wh_logrecord (logrecord_id int(11) NOT NULL auto_increment,user_name varchar(100) default NULL,operation_time datetime...
分类:
数据库 时间:
2014-09-21 00:08:09
阅读次数:
311
设计多对多表时解决重复问题目前流行两种设计方式:方式一 是在中间表中建一个单独的id主键,与业务表关联的键设置为unique唯一;干事二:联合主键的方式,该方式中间表不会有与业务表无关的主键,即把与业务表关联的键进行联合作为主键下面是使用pd来设计表的两种详细方式方式一:中间表采用一个单独的id主键...
分类:
其他好文 时间:
2014-09-20 20:47:19
阅读次数:
470
次小生成树
求最小生成树时,用数组Max[i][j]来表示MST中i到j的最大边权。
求完后,直接枚举所有不在MST中的边,替换掉最大边权的边,更新答案。
#include
#include
#include
using namespace std;
const int maxn = 110;
const int INF = 1e9;
bool vis[maxn];
in...
分类:
其他好文 时间:
2014-09-20 02:17:36
阅读次数:
203
niujie@ubuntu:~$ cat /etc/fstab# /etc/fstab: static file system information.## Use 'blkid' to print the universally unique identifier for a# device; t...
分类:
其他好文 时间:
2014-09-19 10:05:35
阅读次数:
182
1:Shuffle Error: Exceeded MAX_FAILED_UNIQUE_FETCHES; bailing-out Answer:程序里面需要打开多个文件,进行分析,系统一般默认数量是1024,(用ulimit -a可以看到)对于正常使用是够了,但是对于程序来讲,就太少了。修改办法:....
分类:
其他好文 时间:
2014-09-18 11:16:33
阅读次数:
296
题目 Given a string s,find the longest palindromic substring in S.You may assume that the maximum length of S is 1000,and there exist one unique longes....
分类:
其他好文 时间:
2014-09-17 21:46:02
阅读次数:
238
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
编程语言 时间:
2014-09-17 18:15:12
阅读次数:
187
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2014-09-16 23:21:41
阅读次数:
169