自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Nick

亘古而常青的昨天永远是过去,也永远会再来。

  • 博客(24)
  • 收藏
  • 关注

原创 124 Binary Tree Maximum Path Sum 求二叉树的最大路径和

Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path

2017-07-31 10:11:19 294

原创 104/111 Maximum/Minimum Depth of Binary Tree(二叉树求深度)

104 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.求二叉树的最大深度问题用到深度优先搜索DFS,递归的完美应用,跟求二叉树的

2017-07-29 15:11:33 375

原创 85 Maximal Rectangle (最大矩形)

Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Ret

2017-07-27 19:48:28 400

原创 84 Largest Rectangle in Histogram(直方图中最大的矩形)

Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar

2017-07-26 17:32:48 524

原创 88/19 Merge Sorted Array/Remove Nth Node From End of List(指针运算)

88 Merge Sorted Array Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equa

2017-07-25 10:40:31 425

原创 77 Combinations(组合数)

Given two integers n and k, return all possible combinations of k numbers out of 1 … n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]这道题让求1到n共n个

2017-07-24 21:35:18 487

原创 72 Edit Distance (编辑距离)

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) In

2017-07-23 16:48:14 771

原创 62/63 Unique Paths

62 Unique Paths A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is t

2017-07-21 12:12:14 279

转载 利用Hog特征和SVM分类器进行行人检测

之前介绍过Hog特征(http://blog.csdn.net/carson2005/article/details/7782726),也介绍过SVM分类器(http://blog.csdn.net/carson2005/article/details/6453502 );而本文的目的在于介绍利用Hog特征和SVM分类器来进行行人检测。        在2005年CVPR上,来自法国的研究人员Na

2017-07-20 21:34:56 512

转载 目标检测的图像特征提取之HOG特征

目标检测的图像特征提取之(一)HOG特征zouxy09@qq.comhttp://blog.csdn.net/zouxy09 1、HOG特征:       方向梯度直方图(Histogram of Oriented Gradient, HOG)特征是一种在计算机视觉和图像处理中用来进行物体检测的特征描述子。它通过计算和统计图像局部区域的梯度方向直方图来构成特征。Hog特征结合SVM分类器已经被广泛应

2017-07-20 21:31:11 310

转载 SIFT特征提取分析

SIFT(Scale-invariant feature transform)是一种检测局部特征的算法,该算法通过求一幅图中的特征点(interest points,or corner points)及其有关scale 和 orientation 的描述子得到特征并进行图像特征点匹配,获得了良好效果,详细解析如下:算法描述SIFT特征不只具有尺度不变性,即使改变旋转角度,图像亮度或拍摄视角,仍然能够

2017-07-20 19:48:38 481

原创 54/59 Spiral Matrix 螺旋矩阵

54 Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7,

2017-07-20 12:05:08 437

原创 51/52 N-Queens(N皇后问题)

51 N-Queens dfs经典问题,采用回溯法求解。 经典的N皇后问题,基本所有的算法书中都会包含的问题,经典解法为回溯递归,一层一层的向下扫描,需要用到一个pos数组,其中pos[i]表示第i行皇后的位置,初始化为-1,然后从第0开始递归,每一行都一次遍历各列,判断如果在该位置放置皇后会不会有冲突,以此类推,当到最后一行的皇后放好后,一种解法就生成了,将其存入结果res中,然后再还会继

2017-07-19 09:46:41 472

原创 55/45 Jump Game 跳跃游戏

55 Jump Game 思路:贪心算法,每次记录可以跳到的最远距离。class Solution {public: bool canJump(vector<int>& nums) { if(nums.empty()) return false; int reach = 0; for(int i = 0; i <= reach && i

2017-07-18 10:26:41 646

原创 415/43 Add Strings/Multiply Strings

415 Add Strings class Solution {public: string addStrings(string num1, string num2) { reverse(num1.begin(), num1.end()); reverse(num2.begin(), num2.end()); int n1 = num1.

2017-07-17 15:55:48 489

原创 39/40. Combination Sum (两题)

39.Combination Sum 像这种结果要求返回所有符合要求解的题十有八九都是要利用到递归,而且解题的思路都大同小异,相类似的题目有 Path Sum II 二叉树路径之和之二,Subsets II 子集合之二,Permutations 全排列,Permutations II 全排列之二,Combinations 组合项等等,如果仔细研究这些题目发现都是一个套路,都是需要另写一个递归函数,

2017-07-15 19:55:00 323

原创 36/37. Sudoku Solver 数独问题

36 Valid Sudoku class Solution {public: bool isValidSudoku(vector<vector<char>>& board) { bool used[9]; for (int i = 0; i < 9; ++i) { fill(used, used + 9, false);

2017-07-14 11:38:01 325

转载 什么是P问题、NP问题和NPC问题

这或许是众多OIer最大的误区之一。你会经常看到网上出现“这怎么做,这不是NP问题吗”、“这个只有搜了,这已经被证明是NP问题了”之类的话。你要知道,大多数人此时所说的NP问题其实都是指的NPC问题。他们没有搞清楚NP问题和NPC问题的概念。NP问题并不是那种“只有搜才行”的问题,NPC问题才是。好,行了,基本上这个误解已经被澄清了。下面的内容都是在讲什么是P问题,什么是NP问题,什么是NPC问题,

2017-07-13 18:04:41 315

原创 34. Search for a Range

Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is

2017-07-13 11:23:48 240

原创 32. Longest Valid Parentheses

Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which has

2017-07-12 11:43:49 261

原创 腾讯2017秋招笔试编程题

1.[编程题] 编码时间限制:1秒 空间限制:32768K假定一种编码的编码范围是a ~ y的25个字母,从1位到4位的编码,如果我们把该编码按字典序排序,形成一个数组如下: a, aa, aaa, aaaa, aaab, aaac, … …, b, ba, baa, baaa, baab, baac … …, yyyw, yyyx, yyyy 其中a的Index为0,aa的Index为1,aaa

2017-07-11 17:53:36 986

原创 腾讯2017暑期实习生编程题目

1.[编程题] 构造回文时间限制:1秒 空间限制:32768K给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢? 输出需要删除的字符个数。输入描述: 输入数据有多组,每组包含一个字符串s,且保证:1<=s.length<=1000.输出描述: 对于每组数据,输出一个整数,代表最少需要删除的字符个数。输入例子1: abcda google输出

2017-07-10 22:22:29 337

原创 百度2017秋招笔试编程题

1.[编程题] 买帽子时间限制:1秒 空间限制:32768K度度熊想去商场买一顶帽子,商场里有N顶帽子,有些帽子的价格可能相同。度度熊想买一顶价格第三便宜的帽子,问第三便宜的帽子价格是多少? 输入描述: 首先输入一个正整数N(N <= 50),接下来输入N个数表示每顶帽子的价格(价格均是正整数,且小于等于1000)输出描述: 如果存在第三便宜的帽子,请输出这个价格是多少,否则输出-1输入例子1

2017-07-10 20:37:14 1714

原创 欢迎使用CSDN-markdown编辑器

欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl

2017-07-10 20:08:45 307

空空如也

空空如也

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

TA关注的人

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