自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 leetcode 8: String to Integer (C++中int、string等常见类型转换)

题目:Implement atoi to convert a string to an integer.想法简单题,只要会用C++ stringstream 即可。解答#include<sstream> class Solution { public: int myAtoi(string str) { stringstream stream; stream<<

2016-08-31 23:39:19 413

原创 leetcode 7:Reverse Integer(知识点:vector ,复习STL stack,queue)

题目:Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321解答:这道题很简单,但是很坑,测试数据产生的结果如果溢出的话,应该返回0,但是并没有在题目中写到。 测试int类型是否溢出的方法:用long long类型完全一样地做一遍,最后比较两者结果是否相同。#incl

2016-08-29 16:35:05 461

原创 leetcode 6: ZigZag Convertion(easy,知识点:string, vector)

题目:思路:直接遍历,每次遍历的字符分给不同字符串即可。代码:#include <vector> class Solution { public: string convert(string s, int numRows) { if(numRows == 1){ return s; } vector<string>a(n

2016-08-25 21:38:57 362

原创 leetcode 5(知识点:STL string )

题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 想法一题目满足最有子结构性质,可以用动态

2016-08-23 19:12:27 420

原创 leetcode 4 (知识点:stl:vector ,iterator )

题目:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should beO(log(m+n)) O(log (m+n))算法思想(摘自网上,关键是为什么会

2016-08-22 23:21:58 344

原创 leetcode 3 Longest Substring Without Repeating Characters

题目: 想法: 用hash表存储,可以使查询时间降到O(1)O(1),两次循环遍历,实践复杂度为O(n2)O(n^2)。 代码如下:class Solution { public: int lengthOfLongestSubstring(string s) { int i, j; int zm[256]; int len1 = s.length();

2016-08-20 15:58:48 262

原创 VS中dll的使用

本文主要按照该博客实践: C++基础:动态链接库调用方法总结 http://blog.csdn.net/crich_moon/article/details/6039939创建动态链接库文件的主要步骤为: 1.创建MFC的dll 2.创建.h文件,声明导出的函数,如:extern "C" __declspec(dllexport) int _stdcall ADD(int a, int b

2016-08-20 10:58:56 527

原创 leetcode 2

leetcode 2: Add Two Numbers题目:想法1:342 + 465 = 802,再倒序放到链表里面输出。 这个想法虽然很自然,但是其实是有问题的。因为该法没有考虑两个数很大,链表很长的情况。在这种情况下,int ,long long等类型表示的范围都是有限的,所以结果总是会当数字很大的时候出错。想法二:用carry位纪录两个链表对应数字相加后的进位。下一位的数字为a + b +

2016-08-19 19:12:17 237

原创 java jni 的使用

本文使用程序基于该博客: http://blog.csdn.net/jiangwei0910410003/article/details/17465085 就其中细节部分进行一定纠正:首先用cmd进入src目录下,编译该JAVA类, 命令:javac ./com/jni/demo/JNIDemo.java 在该JNIDemo.java所在目录下生成JNIDemo.class然后在src目录下

2016-08-18 23:14:44 330

原创 leetcode 1

题目:Two Sumproblem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. example:

2016-08-03 19:25:09 297

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除