- 博客(52)
- 资源 (5)
- 收藏
- 关注
原创 2016结尾,2017开头
老天从来不会雪中送碳和狂流引渡,从来都是落井下石和锦上添花。现在的自己看自己,真的就是一坨狗屎。人生状态已达历史最低,应该要触底反弹了。2016:1、申请学校失败了2、对自己不负责,身材复胖。3、赌赛小赚、消沉意志、作息全乱4、沉迷网游、荒废时间5、面试碰壁、所学忘光6、年底终于找到工作7、保持阅读,规正作息、复健控食8、认识不足,每日总结,坚持刷题
2016-12-31 15:37:32 302
原创 LeetCode总结-初级篇(1)
想来刷题也有半月余,总共在刷题18道,均为简单题。毕竟自己代码丢了很久,水平有限。就先从简单题入手,打算2017年开始做到一天一题,一题一算,一周一结,一月一回顾,等到简单题都刷完后,再刷中等题,到时候在根据自己的水平在做规划,现在来看看这18题大概都是些什么类型的题目吧。18道题目中大致分为:数组操作、字符串操作、边界陷阱、数学题、数据结构几种。涉及的数据结构:链表:Swap
2016-12-31 09:04:51 453
原创 Length of Last Word
题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A
2016-12-31 08:34:47 199
原创 Count and Say
题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read
2016-12-30 09:20:34 290
转载 使用stringstream对象简化类型转换
【本文来自】http://www.builder.com.cn/2003/0304/83250.shtmlhttp://www.cppblog.com/alantop/archive/2007/07/10/27823.html使用stringstream对象简化类型转换C++标准库中的提供了比ANSI C的更高级的一些功能,即单纯性、类型安全和可扩展性。在本文中,我将展示怎样使用这
2016-12-30 08:42:19 245
转载 Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially filled
2016-12-29 08:24:35 253
原创 Implement strStr()
题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which companies asked this question思想:
2016-12-28 08:54:54 214
原创 Remove Element
题目:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memo
2016-12-28 08:24:45 218
原创 Remove Duplicates from Sorted Array
题目:Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for a
2016-12-28 07:58:02 222
原创 Swap Nodes in Pairs
题目:Swap Nodes in Pairs描述:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm sh
2016-12-27 07:45:03 232
转载 VS2015+OpenCV3.0配置教程
转载:http://blog.csdn.net/whustyle/article/details/48215637最近更新了一下VS2015,发现原来使用的VS2013配置的OpenCV2.4.9无法使用了,网上关于VS2015中配置OpenCV3.0的方法极少,有部分初学者问到便在此写一下,当做初学者的参考。所以索性把OpenCV也更新到3.0了。值得一提的是,虽然VS更新到2015版本
2016-12-26 11:21:04 529
转载 线程锁的概念函数EnterCriticalSection和LeaveCriticalSection的用法
线程锁的概念函数EnterCriticalSection和LeaveCriticalSection的用法转自:http://www.itcodeworld.com/?p=105使用结构CRITICAL_SECTION 需加入头文件#include “afxmt.h”定义一个全局的锁 CRITICAL_SECTION的实例和一个静态全局变量CRITICAL_SECTI
2016-12-26 11:19:45 231
原创 Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Subscribe to see which companies asked this
2016-12-26 07:34:10 246
原创 Valid Parentheses
题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are
2016-12-25 07:07:17 276
原创 Remove Nth Node From End of List
题目:Remove Nth Node From End of List例子:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. Afte
2016-12-24 07:53:02 229
转载 图像的二值化和灰度化
原作者:timidsmile 图像的二值化是将图像上的像素点的灰度值设置为0或255,也就是将整个图像呈现出明显的黑白效果。 将256个亮度等级的灰度图像通过适当的阀值选取而获得仍然可以反映图像整体和局部特征的二值化图像。在数字图像处理中,二值图像占有非常重要的地位,首先,图像的二值化有利于图像的进一步处理,使图像变得简单,而且数据量减小,能凸显出感
2016-12-23 08:10:34 1045
原创 Longest Common Prefix
题目: Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.题意:求所有字符串的最长公共前缀想法:每个字符串都有同样的一个公共前缀,求最长的那个,从字符串容器中取第一个字符串将其每一个字符与其后的字符串依次进行对比即可
2016-12-23 07:31:40 262
原创 Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.规则:罗马数字转成整型,首先要知道罗马数字和整型的联系摘自维基百科罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100
2016-12-22 08:11:55 275
转载 VS2015编译libjpeg库
参考资料: 1、http://blog.csdn.net/joeblackzqq/article/details/42264143 2、http://www.cnblogs.com/summerRQ/articles/2424096.html1、libjpeg库下载地址:http://www.ijg.org/files/jpegsr9a.zip2、解压源代码,修改源代码中j
2016-12-21 15:12:12 2517 2
转载 C++ “string”: 未声明的标识符
解决方案:要添加using namespace std;语句在宏定义后面。解释:所谓namespace,是指标识符的各种可见范围。C++标准程序库中的所有标识符都被定义于一个名为std的namespace中。一 、和和格式不一样 前者没有后缀,实际上,在你的编译器include文件夹里面可以看到,二者是两个文件,打开文件就会发现,里面的代码是不一样的。 后缀为.h的
2016-12-21 09:31:58 35695 2
转载 C++ map的基本操作和用法
1、map简介map是一类关联式容器。它的特点是增加和删除节点对迭代器的影响很小,除了那个操作节点,对其他的节点都没有什么影响。对于迭代器来说,可以修改实值,而不能修改key。2、map的功能自动建立Key - value的对应。key 和 value可以是任意你需要的类型。 根据key值快速查找记录,查找的复杂度基本是Log(N),如果有1000个记录,最多查找10次,1,000
2016-12-21 08:44:54 354
转载 用vim格式化代码(转)
从别的编辑器里粘贴到vim里的代码经常由于不正常的缩进变得格式混乱。在vim的官方FAQ (http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl)找到的:格式化全文: gg=G自动缩进当前行: ==这个是原文节选:14.6. How do I format/indent an entire file?You can
2016-12-21 08:44:19 366
转载 C++中vector模板详解
1. 在C++中的详细说明vector是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。vector之所以被认为是一个容器,是因为它能够像容器一样存放各种类型的对象,简单地说,vector是一个能够存放任意类型的动态数组,能够增加和压缩数据。2. 使用vector,必须在你的头文件中包含下面的代码: #include
2016-12-21 08:43:22 916
原创 Palindrome Number
题目:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of conver
2016-12-21 07:36:10 236
原创 String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca
2016-12-20 07:19:29 239
转载 MFC: DeviceIoControl 通过API访问设备驱动程序
转载:http://m.blog.csdn.net/article/details?id=21602051DeviceIoControl的其实和ReadFile和WriteFile是一样的, 不过这个功能更强, 一次交互能够输入数据, 也可以输出数据.DeviceIoControl内部创建的IRP是IRP_MJ_DEVICE_CONTROL类型的IRP, 然后操作系
2016-12-19 11:42:16 3324
转载 关于MFC中取绝对值的函数——abs()和fabs()
标签: c++ float double c++ double float html中的float 转自: http://blog.csdn.net/yeqiu712/article/details/6542051 view plain#include "stdio.h" #include "math.h"
2016-12-19 10:13:41 2917
原创 Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c
2016-12-19 08:09:52 482
转载 LeetCode:ZigZag Conversion
【版权声明】转载请注明出处:http://www.cnblogs.com/TenosDoIt/p/3738693.html题目链接The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this
2016-12-17 12:32:40 207
转载 简明 Vim 练级攻略
转载自:http://coolshell.cn/articles/5426.htmlvim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的。下面的文章翻译自《Learn Vim Progressively》,我觉得这是给新手最好的VIM的升级教程了,没有列举所有的命令,只是列举了那些最有用的命令。非常不
2016-12-17 11:26:29 225
转载 DoModal 函数的用法
使用有模式对话框时在对话框弹出后调用函数不会立即返回,而是等到对话框销毁后才会返回(请注意在对话框弹出后其他窗口的消息依然会被传递)。所以在使用对话框时其他窗口都不能接收用户输入。创建有模式对话框的方法是调用CDialog::DoModal()。下面的代码演示了这种用法: CYourView::OnOpenDlg() { CYourDlg dlg; int iRet=dlg.DoM
2016-12-16 14:14:18 837
原创 TwoSum
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:Given nums =
2016-12-16 08:38:06 362
转载 MFC多线程各种线程用法 .(编译器版本WieVC6.0)
一、问题的提出编写一个耗时的单线程程序: 新建一个基于对话框的应用程序SingleThread,在主对话框IDD_SINGLETHREAD_DIALOG添加一个按钮,ID为 IDC_SLEEP_SIX_SECOND,标题为“延时6秒”,添加按钮的响应函数,代码如下: void CSingleThreadDlg::OnSleepSixSecond()
2016-12-15 15:33:27 1466
转载 MFC CString 和int相互转化
http://blog.sina.com.cn/s/blog_5fa918660101axuf.htmlCString str = _T("123");int i = _ttoi(str);===============int i = 123;CString str ;str.Format(_T("%d"), i);
2016-12-15 15:17:48 271
转载 多线程与AfxGetMainWnd的吐血遭遇……
把之前用VC6写的MFC工程升级到VC2005后,编译运行就崩溃,莫名其妙,问了ZV说是经常出现这种问题,要重新建立个工程拖代码才行,那好吧,就重来,折腾了好久,还是……又崩溃了……这下头大了,同样的代码,VC6里正常,VC2005反而崩溃?尝试关闭连接的多种选项,除了出现莫名其妙的LNK ERROR以外一无所获,最后F8逐步调试,发现在_beginthread后的WaitForSingl
2016-12-15 10:51:35 473
原创 Implement int sqrt(int x).
题目:Implement int sqrt(int x).Compute and return the square root of x.思路: 我的天呀,一开始拿到这个题目完全没有感想呀,完全不知道啊,做尼玛嗨啊,第一天刷第一题就不会啊,还要把所有题目都刷干净啊,我勒个深深的草啊。网上资料:牛顿迭代法(Newton's method)又称为牛顿-拉夫逊方法(N
2016-12-15 08:09:53 702
转载 memmove 和 memcpy 的区别
原文出处:http://blog.chinaunix.net/uid-26495963-id-3080058.htmlmemcpy和memmove()都是C语言中的库函数,在头文件string.h中,作用是拷贝一定长度的内存的内容,原型分别如下:void *memcpy(void *dst, const void *src, size_t count);vo
2016-12-14 12:20:55 246
转载 C++指针详解
http://www.cnblogs.com/ggjucheng/archive/2011/12/13/2286391.html指针的概念指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址。要搞清一个指针需要搞清指针的四方面的内容:指针的类型,指针所指向的类型,指针的值或者叫指针所指向的内存区,还有指针本身所占据的内存区。让我们分别说明。 先声明几个指针放
2016-12-14 12:08:46 143
原创 给定你任意正整数,请你输出这个正整数的二进制表示中有几个1。
给定你任意正整数,请你输出这个正整数的二进制表示中有几个1。样例如下:输入:7输出:3#includeusing namespace std;int main(){ int i, n=0; cin >> i; while (i >= 1) { if (i % 2 == 1)
2016-12-14 09:12:36 1204
原创 AfxBeginThread创建线程时出现内存不足
CMyThread* m_pThread1;m_pThread1=(CMyThread*)AfxBeginThread(RUNTIME_CLASS(CMyThread),THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);这是按照书中的例子写的一个线程,编译通过,但运行时跳出“内存不足”对话框。调试到里面是CWinThread* pThread
2016-12-13 10:41:08 2675 2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人