- 博客(9)
- 收藏
- 关注
原创 (leetcode)Missing Number
Missing Number 题目Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2. 解决方案:
2015-09-25 17:22:47 251
原创 (leetcode)Rotate Array
题目:Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to[5,6,7,1,2,3,4]. 将包含七个元素的数组向右移动k位。 C++一种解决方法:class Sol
2015-05-16 15:17:01 296
原创 (leetcode) Reverse Integer
题目Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 C++实现class Solution {public: int reverse(int x) { double result = 0; whil
2015-05-08 21:03:30 262
原创 C++动态申请二位数组内存空间
C++动态申请二位数组内存空间int** core; //可以理解为指针数组 *core[]core=new int*[box]; //new一个指针数组, core指向首元素for(int i=0;i<box;i++){ core[i]=new int[box]; //逐行定义列数组}delete[] core;
2015-05-05 10:13:16 518
原创 opencv2.4.8在VS2010开发环境下的配置
opencv2.4.8+Vsual Sudio 2010 环境配置一、安装opencv2.4.8以及visual studio 2010 二、新建VS工程如下图(创建过程参考C++开发) 三、右键我的电脑——>属性——>高级系统设置——>环境变量 在系统变量中找到Path(如果没有自己添加),在最后加上I:\opencv\b
2015-05-03 16:51:26 518
原创 Remove Linked List Elements
leetcode题目Remove Linked List ElementsRemove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --
2015-05-03 16:29:19 277
原创 正整数n内包含质数(素数)的个数
leetcode题目 质数问题Description:Count the number of prime numbers less than a non-negative number, n解决方案:class Solution {public: int countPrimes(int n) { bool *p=new bool[n];
2015-05-01 16:44:38 1243
原创 C++ 字符串长度问题
题目:在写程序中遇到字符串的长度问题,总结一下出错的地方。代码: string s1="123456"; char* s2="123456"; char s3[]="123456"; cout cout cout cout打印结果为 6(这表示string字符串包含字符的长度) 32(表示s
2015-04-30 19:39:24 1356
原创 leetcode(c++) Isomorphic Strings
leetcode 题目练习Isomorphic Strings 题目要求:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to gett.All
2015-04-29 21:48:01 468
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人