自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 资源 (2)
  • 收藏
  • 关注

原创 [LeetCode]Generate Parentheses

题目要求如下:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "(

2014-01-02 11:40:54 986

原创 [LeetCode]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 "()[]{}"

2013-12-28 11:45:34 9098 2

原创 [LeetCode]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. After removing the second node from the end,

2013-12-03 10:19:28 1190

原创 list iterator not decrementable

刚遇到这个“list iterator not decrementable”的问题,网上多数解决方案是这样的:意思就是在#include "stdafx.h"的下一行加上#define _HAS_ITERATOR_DEBUGGING 0 这样虽然能解决部分问题,但其实出现这个错误的根源在我们的代码之中,如这位仁兄所回答的一样:意思就是,错误的根源在我们的代码中,因为C++标

2013-11-30 12:14:43 5546

原创 [LeetCode]Letter Combinations of a Phone Number

题目要求如下:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Dig

2013-11-27 22:10:35 903

原创 [LeetCode]3Sum Closest

题目要求如下:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would h

2013-11-25 12:39:43 952

原创 [LeetCode]3Sum

题目要求如下:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in

2013-11-24 11:20:37 7951

原创 [LeetCode]Longest Common Prefix

题目要求如下:Write a function to find the longest common prefix string amongst an array of strings.找出所有字符串的最长公共前缀。这道题很简单,但需要注意减少比较字符的操作次数。思路是这样的:2个字符串的最长公共前缀,其长度肯定不会超过最短的字符串的长度,设最短的字符串长度为n,那么只要比较这2个

2013-11-22 12:37:41 22441 1

原创 [LeetCode]Longest Palindromic Substring

题目要求如下: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.也就是传说中的求最长回文子

2013-11-22 11:30:42 2183

原创 求最长回文子串(Longest Palindromic Substring)

求解最长回文子串问题最近经常遇到,因而有了一个学习的契机。先说说回文字符串,回文字符串的意思是从左往右看和从右往左看都是一样的,即我们如果以中心为轴,这个字符串是左右对称的,如字符串"abcba","abba"。字符串"abcba"有奇数个字符,所以以中间字符'c'为轴左右对称,而字符串"abba"有偶数个字符,所以是对半开来对称的。而顾名思义,最长回文子串就是指一个字符串中最长的具有回文

2013-11-22 11:12:03 8275 1

原创 动态规划求解最长公共子序列(LCS)

看了《算法导论》中文第二版P208的动态规划求解LCS问题,觉得很赞,但总觉得算导写得有些晦涩,希望自己能写得简单易懂一些,纯当锻炼了,欢迎指导交流。首先,子序列和子串是不一样的。子串是连续的,而子序列中的元素组成可以是不连续的,但元素的位置下标一定是递增的。以一个字串S = "abcdef"为例,字串S的一个子串是"abc",'cdef'这种连续的,而子序列可以是"abc",也可以是"af

2013-11-15 20:23:47 9160 1

原创 [POJ]1458-Common Subsequence

题目要求:DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exis

2013-11-15 20:19:55 732

原创 [LeetCode]Container With Most Water

题目要求:Given n non-negative integers a1, a2, ...,an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of linei is at (i, ai) and (i

2013-11-14 21:27:01 853

原创 [LeetCode]Palindrome Number

题目要求:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to strin

2013-11-13 21:55:16 893

原创 [LeetCode]String to Integer (atoi)

题目要求:mplement 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 inpu

2013-11-13 21:45:36 5744 2

原创 [LeetCode]Reverse Integer

题目要求:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Have you thought about this?Here are some good questions to ask before coding. Bonus points for

2013-11-13 21:34:43 13261 10

原创 [LeetCode]Median of Two Sorted Arrays

题目要求:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).如果使用像归并排序那样的归并方式,从头遍历A和B,比较A

2013-11-09 12:10:28 1150

原创 [LeetCode]ZigZag Conversion

题目要求:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA

2013-11-04 11:46:29 19054 2

原创 [LeetCode]Longest Substring Without Repeating Characters

题目要求:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is

2013-11-03 11:15:31 955

原创 [LeetCode]Add Two Numbers

题目要求:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2013-11-01 22:23:21 17669 3

原创 [LeetCode]Two Sum

题目要求:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target,

2013-11-01 20:48:37 2291 4

原创 插入排序的递归写法

刚去笔了某公司(笔试的时候要求把手机放在信封里)的题,今天睡得太多,脑子各种不清醒,题目都很基础,就是没反应过来,这道题很容易却没做出来,鄙视自己。题目要求总的来说就是要编写一个函数 void InsertSort (int s[ ] , int size),用递归的方式完成插入排序的算法。回来后自己写好并验证了一下,当时的想法是对的,只是没写好。以下是回来后写的代码://writ

2013-10-31 22:41:42 1741

原创 Visual Studio VS2010统计代码行数

在网上看到别人用的方法: 按CTRL+SHIFT+F (Find in files),勾上支持正则表达式,然后输入搜索内容:^:b*[^:b#/]+.*$以上表达式的统计可做到:#开头和/开头或者空行都不计入代码量。如果需要只统计代码文件的代码量,可以选择查找文件的类型,比如什么*.xml, *.resx….可以不检查,只查*.cs,*.c,*.h…搜索出来以后最后一行就是代码

2013-07-10 17:04:49 46994 2

原创 C++ 模板类使用函数指针

前几天重看了C++ primer的第16章,正好同时也复习了树的操作,于是写了个二分查找树的模板类。一开始挺顺利,后来想尝试一下使用函数指针来传递遍历树的函数,因此有了下面的问题,也从解决方法中学到了很多。       我想要的实现是这样的:有一个TravelRecursive函数,专门负责用递归的方式遍历整棵树,而遍历的方法(中序、前序、后序)想用函数指针传进来。对结点的处理函数也想用函数指

2013-05-23 16:59:01 8016

原创 微软面试100题系列-第1题

注:微软面试100题系列中的题都是v_JULY_v(http://blog.csdn.net/v_JULY_v)收集的面试题,具体PDF下载地址为:http://download.csdn.net/detail/v_july_v/4583815                写文的目的是锻炼自己,欢迎各位大牛提出建议,批评指正~第一题:把二分查找树转变成排序的双向链表输入一棵二分查找树

2013-05-23 15:33:45 1028

原创 微软面试100题系列-第3题

注:微软面试100题系列中的题都是v_JULY_v(http://blog.csdn.net/v_JULY_v)收集的面试题,具体PDF下载地址为:http://download.csdn.net/detail/v_july_v/4583815 写文的目的是锻炼自己,欢迎各位大牛提出建议,批评指正~ 第3题:求子数组的最大和输入一个整型数组,数组里有正数也有负数。数组中连续的一个或

2013-05-15 16:16:48 769

原创 微软面试100题系列-第2题

注:微软面试100题系列中的题都是v_JULY_v(http://blog.csdn.net/v_JULY_v)收集的面试题,具体PDF下载地址为:http://download.csdn.net/detail/v_july_v/4583815                写文的目的是锻炼自己,欢迎各位大牛提出建议,批评指正~       第二题,题目如下:

2013-05-10 11:54:06 803

原创 算法导论第二章POJ水题

第二章介绍了插入排序和归并排序,于是想到POJ上弄几道水题练下。排序的水题果断都好水,归并没有用哨兵,而是直接使用了2.3-2习题的方式,插入排序在查找位置的时候用的是2.3-6习题提到的二分查找。不过虽然是水题,但我是菜鸟水平,所以当看到高手用48K和0MS解决掉这些题后,真心觉得自己弱爆了。        水题号:2388;        归并:2388Ac

2012-08-01 14:39:02 865

原创 MFC 获取picture控件的鼠标点击坐标位置的方法

在一个自定义的Dialog中加入了picture控件,想要获取鼠标在该控件上的点击位置,遇到一些困难,最终解决了。方法如下:     其实挺简单的,首先用自定义的Dialog类重载CDialog的PreTranslateMessage函数,并在其中用到了Dialog的OnLB

2011-09-15 17:11:52 16633 9

原创 如何将资源从一个项目移到另一个项目 & MFC VS 的资源中文乱码

      打开VS20XX,打开->文件,找到想要的资源所在的项目文件夹,将文件类型选成.rc,就会自动出现该项目的.rc文件,双击则可出现树状资源目录。在目录上点想要的资源,右键那可发现“复制”选项,接下来就。。。嘿嘿~http://support.microsoft.com/kb/829437 微软的详细教程

2011-04-27 13:28:00 2091

原创 《暗示与知我暗示》——埃米尔

1.意志总是在努力反抗不好的想像,但越是努力反抗,与我们愿望相反的结果就出现越快。2.我们人类与绵羊有种某种相似性,不知不觉中,我们无法抗拒驱使着去模仿别人的做法,想像着:我们无法通过别的方法来做了。

2011-03-26 13:41:00 680

原创 [C++] Expression : invalid operator < 解决方法

<br />VS2008的sort()函数的用法貌似挺郁闷的。。。<br /> <br />前些时候写了个sort的compare函数,错误"Expression : invalid operator <",baidu+google了一下,没有找到比较明确的说法,不过找到了微软的一个网页,说得算是很清楚,不过看得不太明白。意思大概是出这个错是因为VS2005,VS2008后的sort()里,用的是所谓的“ strict weak ordering”,也就是说,如果a==b,则返回的应该是false,如果返回

2011-03-03 12:23:00 11207 2

原创 C++ CArray类及子类,使用sort()排序

http://www.codeguru.com/forum/archive/index.php/t-215414.html这篇贴子帮了大忙。有一个回贴这样说到:#include ...// Note the *only* change is the template type!CArray MyCArray;//...std::sort( MyCArray.GetData(), MyCArray.GetData() + MyCArray.GetSize());It doesn't matter whethe

2011-02-21 18:28:00 4147

转载 error C2248: 'CObject::operator =' : cannot access private member declared in class

<br /> <br />用sort进行排序的时候遇到了这个错误,上网一搜,发现了原因所在。又学到东西了,真是庆幸至极。<br /> <br /> <br />1>e:/program files/microsoft visual studio 9.0/vc/atlmfc/include/afxtempl.h(776) : error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject'

2011-02-21 11:27:00 3103

原创 解决方案:1>LINK : fatal error LNK1000: Internal error during IncrBuildImage

<br />从网上看来的,用VS2008后经常遇到这个问题。<br /> <br />解决:项目(Project)->属性(Property)->链接器(Linker)->常规(General) 下面的“启用增量链接(Enable Incremental Linking)”,将“是(/INCREMENTAL)”改为“否(/INCREMENTAL:NO)”。不过这又引入了另外一个警 告:FormatCom.obj : warning LNK4075: 忽略“/EDITANDCONTINUE”(由于“/INCR

2011-02-16 17:41:00 1639

原创 还差得远

<br />   果然看大牛的BLOG是刺激自己成长的动力来源。我还差得远呢!

2011-01-29 21:34:00 514

转载 VS2008中OpenGL环境配置(转载自http://yu.an.jin.5.blog.163.com/blog/static/5315581120104285141647/)

1.安装下载OpenGL类库 http://download.csdn.net/source/274113(这个是1.4版本的),也可以到OpenGL官网下载其他版本。将.h文件拷贝到C:/Program Files/Microsoft Visual Studio 9.0/VC/include/GL目录中(没有GL目录就自己创建一个,这里的具体路径视电脑上VS2008安装的位置而定)将.lib文件拷贝到C:/Program Files/Microsoft Visual Studio 9.0/VC/lib目录

2011-01-28 19:01:00 980

原创 VS2008下mysql数据库配置(使用c-api)

配置说明:使用数据库为MySQL,版本为5.0.83在VS2008中的配置如下:1.工程属性—》C/C++—》Ddditional Incluce Directories—》填入mysql目录下的include文件夹地址。如我的是:"D:/phpnow/MySQL-5.0.83/include"2.工程属性—》Linker—》Ddditional Library Directories-》填入mysql目录下的lib文件夹地址。如我的是D:/phpnow/MySQL-5.0.83/lib"3.工程运行还需要

2011-01-27 13:19:00 2467

原创 VS2008下,CString与string互转换,LPTSTR转CString,char * 转LPTSTR

   这个问题很纠结,由于unicode的缘故,搞得我这个新手很无奈。还好解决了,现将方式写下,希望以后能找到更好的方法。CString->string (需要两次转换) string  C2S(CString cstr){      LPTSTR lpsz = new TCHAR[cstr.GetLength()+1];     _tcscpy(lpsz, cstr);    char *p=new char[(cstr.GetLength()+1)*2];     WideCharToMultiByte

2011-01-23 12:23:00 5566

转载 mysql c api 列表(转贴自http://blog.csdn.net/loveu131/archive/2006/07/26/982629.aspx)

为了方便以后不再找mysql 的API,于是转了CSDN站内ID为loveu131的贴子。FunctionDescriptionmysql_affected_rows()Returns the number of rows changed/deleted/inserted by the last UPDATE, DELETE, or INSERT query.mysql_autocommit()Toggles autocommit mode on/off.mysql_change_user()Changes

2011-01-13 13:05:00 1099

同济第五版高等数学习题答案

同济第五版高等数学 习题答案 考研同学们共勉

2010-04-10

空空如也

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

TA关注的人

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