自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 C++ 虚函数表解析

看过的最好的一篇关于虚函数解析的文章: 前言 C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来实现可变的算法。比如:模板技术,RTTI技术,虚函数技术,要么是试图做到在编译时决议,要么试图做

2014-04-08 16:44:54 959

原创 leetcode Reverse Words in a String

Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". 题目比较简单,就是倒置一下字符串。中间说的几个细节,开头,末尾,包括中间都可能出现多个空格,都需要忽略。格式化为每个词之间只有一个空格的

2014-03-11 10:42:23 940

原创 leetcode Implement strStr()

Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 朴素匹配好像超时,只能改用kmp了。关于kmp算法就不多说了,是很经典的问题了,我只想补充一下,kmp有两种写法,有一个优化版本的。这两

2013-12-27 22:12:45 1072

转载 浅析人脸检测之Haar分类器方法:Haar特征、积分图、 AdaBoost 、级联

浅析人脸检测之Haar分类器方法 一、Haar分类器的前世今生        人脸检测属于计算机视觉的范畴,早期人们的主要研究方向是人脸识别,即根据人脸来识别人物的身份,后来在复杂背景下的人脸检测需求越来越大,人脸检测也逐渐作为一个单独的研究方向发展起来。        目前的人脸检测方法主要有两大类:基于知识和基于统计。 Ø  基于知识的方法:主要利用先验知识将人脸看作器

2013-12-25 14:03:18 1604

原创 leetcode Anagrams

最近虽然在做题,但是没有什么心情写博客。冷暖自知。。上面的题目做了135/150,随便贴个题目mark一下。 class Solution { public: vector anagrams(vector &strs) { vector res; map > st; int n=strs.size(); if(n<1) return res

2013-12-24 16:06:41 1143

原创 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: "((()))", "(()())", "(())()", "()(())", "()()

2013-12-11 21:48:28 1254

原创 leetcode Longest Valid Parentheses

这个星期没有做题,跑出去玩了一圈。投个实习感觉被鄙视了,回来继续学习算了。 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the

2013-11-27 13:59:17 1534

原创 leetcode Interleaving String

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbbaccc", r

2013-11-19 21:51:50 1409 2

原创 leetcode Sort List (Sort a linked list in O(n log n) time using constant space complexity)

链表归并排序。

2013-11-18 12:53:17 7496 4

原创 leetcode Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be non

2013-11-15 11:28:20 847

原创 leetcode Restore IP Addresses

好久没有更新了。最近在看stl源码解析。所以没有太做题了。顺便说下这本书,乍一看感觉很难,仔细看几天收获还是不错。只能感叹c++泛型机制好流弊。。。leetcode上面也就做了50个。 Given a string containing only digits, restore it by returning all possible valid IP address combinati

2013-11-14 19:57:01 776

转载 深入C++的new (转载)

转自:http://blog.csdn.net/songthin/article/details/1703966 最近在看stl源码解析,刚好看到这个相关的,拿来mark一下。 “new”是C++的一个关键字,同时也是操作符。关于new的话题非常多,因为它确实比较复杂,也非常神秘,下面我将把我了解到的与new有关的内容做一个总结。 new的过程 当我们使用关键字new在堆上

2013-11-09 23:01:17 916

原创 leetcode Binary Tree Preorder Traversal Binary Tree Postorder Traversal Inorder Traversal

最近几天都没有在leetcode做题了,今天来了做了几个二叉树。发现二叉树的题目真的很多,都是些一般的基础。没有什么说的。找两个最近的题做了贴上吧。 前序遍历二叉树,这个没有什么说的。借助于堆栈可以轻松的实现。题目要求不用递归实现。 class Solution { public: vector preorderTraversal(TreeNode *root) {

2013-11-08 15:27:06 1070 2

原创 leetcode Linked List Cycle II 继续写。

上次写了关于寻找环开始的解法,上网了搜了一下解法,发现原来这题是有故事的。具体大家可以去搜一搜,是个英文的blog。 代码就没有什么说的,如果知道了解法。代码是非常简单的。 大概的说一下解法, 1):定义两个指针S,F分别对应每次走一步,两步指针。就是快慢指针。初始都指向头结点。 2):当有环时,S==F。将其中一个指向(比如S)head,同时S和F相同的速度向后移动,当S==F时

2013-11-05 22:14:34 2846 2

原创 leetcode Word Break I II 算法分析

今天就挑两个题,这两个题的解法多种多样。思想就两个dp和dfs。看来oj还是非常的喜欢这两个技术。可能面试的时候,大家都喜欢这类题目吧。 题目1: Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of

2013-11-03 15:09:13 6431 3

原创 leetcode Palindrome Partitioning I II

每到周五就想放松么,还是写两个题解吧。今天写了几个问题,发现都是动态规划的问题。就说这两个吧。 题1: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.

2013-11-01 22:14:57 1252 1

原创 leetcode Linked List Cycle I II

今天抽空做了几题,突然发现下面的题都过去很久了,发现这两天更新了两个链表,就写这两个链表吧。 题目1: 题目就是判断一个链表是否有环。。要求不增加额外空间。如果以前没有做过可能会卡,这个题因为我以前见过就直接写代码了,没有在本地测试,直接写上去了,两次ac。。。 解法的证明我就不多说了,大家搜搜吧。。定义两个指针pre,p每次一个走两步,一个走一步。如果链表有环的话,那么就会pre==p。如

2013-10-31 21:52:58 1141 3

原创 leetcode Best Time to Buy and Sell Stock I II III

这三个题目是连续的就一同写下自己的想法吧。 题目1: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one an

2013-10-30 21:01:33 1450 1

原创 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-10-29 21:58:03 954 1

原创 leetcode Container With Most Water

今天在leetcode上做了一天,随便找了一些题大概做了10几个,感觉面试题真的很能体现个人能力啊。 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

2013-10-29 21:27:10 845

原创 blog开通,像大家学习。

很久就想写个自己的博客,就是一直在学校无所事事找不到合适的东西写写。最近学长们都开始找工作,看着他们忙碌的在各个公司奔跑,于是开始想象自己明年的命运。于是像他们讨点东西来学习。看他们找工作在leetcode做题,既然没事那就从这个oj开始吧。 int day=0; while(day++) { i.learn(others.CSDN_blogs()); }

2013-10-29 09:49:28 947

空空如也

空空如也

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

TA关注的人

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