![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 52
lddladada
这个作者很懒,什么都没留下…
展开
-
字符数组、字符串的声明及初始化问题
int main() { char a[2]; char b[2] = {'a', 'b'}; char c[3] = {'a', 'b', '\0'}; char* d = "abc"; char* e = new char[2]; return 0; } 声明字符数组a,但未初始化,可见其指向的地址,内容为乱码; 而初始化数组b;其中b[0],b[原创 2015-06-29 22:23:50 · 798 阅读 · 0 评论 -
最长递增子序列(longest increasing subsequence)
问题 给定一个长度为N的数组,找出一个最长的单调自增子序列(不一定连续,但是顺序不能乱)。例如:给定一个长度为6的数组A{5, 6, 7, 1, 2, 8},则其最长的单调递增子序列为{5,6,7,8},长度为4. int LIS(int nums[], int n, int result[]){//暴力法,时间O(n^2) int* lis = new int[n]; int*原创 2015-10-20 16:16:30 · 339 阅读 · 0 评论