自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 leetcode 437 Path Sum III

You are given a binary tree in which each node contains an integer value.Find the number of paths that sum to a given value.The path does not need to start or end at the root or a leaf, but it mus...

2019-07-28 21:51:13 182

原创 leetcode 283 Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:You m...

2019-07-07 21:54:20 197

原创 leetcode 198 House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house...

2019-03-06 22:12:59 283

原创 leetcode 160 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.Notes:If the two linked lists have no intersection at all, returnnull. The linked lists must retain t...

2019-03-03 22:10:04 420

原创 leetcode 203 Remove Linked List Elements

Remove all elements from a linked list of integers that have valueval.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1->2->3->4->5给定一个链表,删除链表中值为指定值的节点。代码没有什...

2019-03-02 21:07:39 207

原创 leetcode 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 trying to reach the bo...

2019-02-24 22:26:04 198

原创 leetcode 206 Reverse Linked List

Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed either iteratively or recursi...

2019-02-22 23:08:25 173

原创 leetcode 230 Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Example 1:Input: root = [3,...

2019-02-17 10:36:30 385

转载 【转】git rebase和merge的使用场景及区别

什么是 rebase?git rebase 你其实可以把它理解成是“重新设置基线”,将你的当前分支重新设置开始点。这个时候才能知道你当前分支于你需要比较的分支之间的差异。原理很简单:rebase需要基于一个分支来设置你当前的分支的基线,这基线就是当前分支的开始时间轴向后移动到最新的跟踪分支的最后面,这样你的当前分支就是最新的跟踪分支。这里的操作...

2019-02-16 15:02:52 716

原创 leetcode 94 Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,3,2]给定一个二叉树,计算其中序遍历结果。二叉树的遍历一般分为两种,递归遍历和非递归遍历,递归遍历代...

2019-02-16 12:43:14 318

转载 【转】C++ 常见面试题

1. extern关键字的作用     extern置于变量或函数前,用于标示变量或函数的定义在别的文件中,提示编译器遇到此变量和函数时在其他模块中寻找其定义。它只要有两个作用:当它与“C”一起连用的时候,如:extern "C" void fun(int a,int b)...

2019-02-11 22:35:00 203

原创 C++ 单例模式

引言前段时间面试时遇到一个问题,静态变量是否为线程安全的。静态变量在编译时进入main()函数前便进行初始化,其生命周期伴随着整个程序的生命周期,在程序结束时才会释放内存。对于静态实例变量,其在构造的时候是线程安全的,构造过程中第一个线程执行构造,其他线程会阻塞在构造的过程,然后构造完毕后该对象内部的静态变量是非线程安全的,因为其共享的是一份内存。因此,在设计工具类的时候,对于没有使用静态...

2019-02-10 22:51:57 216

原创 leetcode 5 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.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exam...

2019-02-09 13:58:01 185

原创 leetcode 11 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 line i is at (i, ai) and (i, 0). Find two...

2019-02-09 10:22:58 230

原创 leetcode 2 Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...

2019-02-09 09:55:32 353

转载 TortoiseGit处理代码冲突

场景一 user0 有新提交user1 没有pull -> 写新代码 -> pull -> 提示有冲突 解决办法一-> stash save(把自己的代码隐藏存起来) -> 重新pull -> stash pop(把存起来的隐藏的代码取回来 ) -> 代码文件会显示冲突 -> 右键选择edit conficts,解决后点...

2019-02-08 21:24:07 448

转载 C++ 虚函数实现机制

转 C++面试题之虚函数(表)实现机制 前言大家都应该知道C++的精髓是虚函数吧? 虚函数带来的好处就是: 可以定义一个基类的指针, 其指向一个继承类, 当通过基类的指针去调用函数时, 可以在运行时决定该调用基类的函数还是继承类的函数. 虚函数是实现多态(动态绑定)/接口函数的基础. 可以说: 没有虚函数, C++将变得一无是处!既...

2019-02-07 19:40:18 2753 4

原创 leetcode 461 Hamming Distance

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, y < 23...

2019-02-07 10:26:34 234

原创 leetcode 260 Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.Example:Input: [1,2,1,...

2019-02-06 21:44:08 177

原创 dll使用stl/模板注意事项

起源前段时间面试遇到这样一个问题:“封装dll时需注意哪些事项”,当时不知道题意,更理不清思路,当然,整个面试也挂掉了。现在看来,这个题目有点太大了,刨去dll位数等不讲,我们针对dll中传递stl这种情况进行分析。现象在使用vs2010调用opencv2.4.10这个版本的findcontours函数时,传入了vector<vector<cv::point>&g...

2019-01-29 23:59:39 997

原创 剑指offer 10 斐波那契数列

递归解法:long fibonacci(int n){ if(n <= 0) return 0; if(n == 1) return 1; return fibonacci(n -1) + fibonacci(n - 2);}在剑指offer中提到,面试时如果仅仅是做出递归的解法,估计是通过不了面试的。我们分析递归的过程,以求f(10)为例,需先求f(9)和f(8...

2019-01-29 22:32:57 236

转载 【转】C/C++运行时库

                                       你所不知道的C和C++运行库    在使

2019-01-29 08:52:25 465

原创 leetcode 33 Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2019-01-27 23:16:13 172

原创 C++面试题记录(持续更新)

1、类模板函数模板template<typename T>int compare(const T &v1, const T &v2){ if(v1 < v2) return -1; if(v2 < v1) return 1; return 0;}类模板template <typename T>class Com...

2019-01-27 22:31:16 170

转载 【转】排序算法总结

0、算法概述0.1 算法分类十种常见排序算法可以分为两大类:非线性时间比较类排序:通过比较来决定元素间的相对次序,由于其时间复杂度不能突破O(nlogn),因此称为非线性时间比较类排序。线性时间非比较类排序:不通过比较来决定元素间的相对次序,它可以突破基于比较排序的时间下界,以线性时间运行,因此称为线性时间非比较类排序。 0.2 算法复杂度0.3 相关概念...

2019-01-20 12:48:51 121

原创 leetcode 21 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.Example:Input: 1->2->4, 1->3->4Output: 1-...

2019-01-19 21:59:01 123

原创 leetcode 22 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:[ "((()))", "(()())", "(())()", "()(())"...

2019-01-19 20:54:28 94

原创 leetcode 20 Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...

2019-01-16 08:50:40 124

原创 SVD原理及解线性方程组、PCA分析的应用

SVD原理SVD定义1、对于方阵,我们可以将其特征分解为:    A=X∧X−1A=X∧X−1X的列:为A的特征向量 ∧为对角矩阵:对角线上的值为A的特征值,按从大到小的顺序排列2、对于普通矩阵,其总可以进行奇异值分解:     A=UΣ其中U 和V都为正交矩阵,Σ为对角矩阵 几何含义:      表示找到了U和V这样两组基:A矩阵的作用是将一个向量从V这组正交...

2019-01-15 22:32:08 1288 1

原创 leetcode 19 Remove Nth Node From End of List

Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, t...

2019-01-15 13:36:34 166

原创 leetcode 15 3Sum

Given an array nums of n integers, are there elements a, b, c in nums such that a + b+ c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not conta...

2019-01-15 09:18:48 105

原创 双目视觉原理及流程概述

双目原理双目视觉是利用视差原理的一种视觉方法。如图所示为空间中一点P在左右相机中的成像点Pleft=(Xleft,Yleft),Pright=(Xright,Yright)。将两相机固定在同一平面上,则点P在Y方向的坐标是相同的,即Yleft = Yright =Y。根据三角原理,可得:视差被定义为相同点在左右相机X方向的偏差,即:Disparity=Xleft-Xright。...

2019-01-14 21:58:55 35260

原创 leetcode 3 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...

2019-01-11 09:18:57 111

原创 leetcode 1 Two Sum

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, and you may not use the same ...

2019-01-08 23:00:51 116

原创 leetcode 139 Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-emptywords, determine if s can be segmented into a space-separated sequence of one or more dictionary words.Note:The s...

2019-01-08 22:30:26 141

原创 相机模型及相机标定原理详解

相机模型除进行高精度尺寸测量使用远心镜头外,我们正常使用的相机镜头都是普通镜头,其成像模型都是理想的小孔成像模型。我们在光轴中心处建立坐标系,Z轴方向平行于光轴,正方向为相机到拍摄对象的方向,X方向取图像坐标系的方向,可以理解为上述平面的X轴。根据上图,我们可以得到相机模型中重要的几个坐标系:世界坐标系、相机坐标系(Xc、Oc、Yc组成)、像平面坐标系,还有像素坐标系。其中像平面坐...

2019-01-07 20:22:13 4417

原创 leetcode 136 Single Number

Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...

2019-01-05 15:53:48 108

原创 leetcode 131 Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.Example:Input: "aab"Output:[ ["aa","b"], ["a","a"...

2019-01-05 08:45:05 157 1

原创 矩形检出算法介绍

背景矩形检出算法即从一副图像中找出候选矩形,不同于hough找圆等算法在opencv中有现成接口,矩形检出算法需要自己手动实现。其常见用途是移动端拍摄文档进行矫正等,近期开发二维码识别时也用到了矩形检出的算法,在此一并做个总结。常规算法常规算法也是最直观、大家都能想到的算法(此处搬运别人公众号的内容:https://mp.weixin.qq.com/s/mkRjgQ8XY4L73ovV...

2019-01-03 17:28:40 9125 2

原创 leetcode 121 Best Time to Buy and Sell Stock

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 (i.e., buy one and sell one share of the stock),...

2019-01-02 23:08:33 121

空空如也

空空如也

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

TA关注的人

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