自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 层次遍历构建二叉树

struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};TreeNode* createTree(vector<string> nodes) { int len

2017-05-22 21:00:49 2869 3

原创 8皇后问题

bool check(vector<int> res) { for (int row = 0; row < res.size()-1; row++) { for (int col = row+1; col < res.size(); col++) { if (row - col == res[row] - res[col] || row - col =

2017-05-13 16:29:17 470

转载 Hough变换理解

reference: http://blog.csdn.net/app_12062011/article/details/11307053一、简单介绍Hough变换是图像处理中从图像识别几何形状的基本方法之一,霍夫变换寻找直线和圆的方法相比其他方法,可以更好的减少噪声干扰。经典的霍夫变换常用来检测直线,圆,椭圆等。Hough变换的基本原理在于利用点与线的对偶性,将原始图像空间的给定曲线通过曲线表达

2017-04-17 22:08:44 748

转载 ubuntu tmp目录overflow的解决方案

http://blog.csdn.net/pang040328/article/details/40041821

2017-03-28 16:08:19 1217

原创 华为2017年机试_反转数字求和

题目: 反转数字求和。输入“123,456”,反转后求和:321+654=975,输出975。分析: 输入的是字符串,主要涉及到字符串到数字的转换,反转可用数字求余或字符串的反转。用到的函数:getline(cin, str)//输入,以enter结束str.find(','); //返回逗号的位置string str1(str, pos, len); //字符串的构造stoi(str1)

2017-03-25 11:49:41 1301

转载 TCP/IP协议入门篇

TCP/IP协议入门篇:看到一篇讲TCP/IP协议的博客,觉着很好理解,记录以下,权当入门。引言:话说两台电脑要通讯就必须遵守共同的规则,就好比两个人要沟通就必须使用共同的语言一样。一个只懂英语的人,和一个只懂中文的人由于没有共同的语言(规则)就没办法沟通。两台电脑之间进行通讯所共同遵守的规则,就是网络协议。那么谁来制定这个网络协议?国际标准化组织(ISO)定义了网络协议的基本框架,被称为OSI模

2017-03-21 23:58:59 454

原创 剑指OFFER_求数组中逆序对的个数

题目描述:在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数P。并将P对1000000007取模的结果输出。 即输出P%1000000007 输入描述:题目保证输入的数组中没有的相同的数字 数据范围: 对于%50的数据,size<=10^4 对于%75的数据,size<=10^5 对于%100的数

2017-03-19 12:16:18 542

转载 蓄水池采样算法(Reservoir Sampling)

蓄水池采样算法:问题描述:采样问题经常会被遇到,比如:从 100000 份调查报告中抽取 1000 份进行统计。从一本很厚的电话簿中抽取 1000 人进行姓氏统计。从 Google 搜索 “Ken Thompson”,从中抽取 100 个结果查看哪些是今年的。这些都是很基本的采用问题。既然说到采样问题,最重要的就是做到公平,也就是保证每个元素被采样到的概率是相同的。所以可以想到要想实现这样的

2017-03-12 15:09:23 759

转载 网易编程题_字符串编码

给定一个字符串,请你将字符串重新编码,将连续的字符替换成“连续出现的个数+字符”。比如字符串AAAABCCDAA会被编码成4A1B2C1D2A。 输入描述: 每个测试输入包含1个测试用例 每个测试用例输入只有一行字符串,字符串只包括大写英文字母,长度不超过10000。输出描述: 输出编码后的字符串输入例子: AAAABCCDAA输出例子: 4A1B2C1D2A#in

2017-03-12 14:41:26 1000

原创 LeetCode_minimum-depth-of-binary-tree

minimum-depth-of-binary-tree链接:https://www.nowcoder.com/practice/e08819cfdeb34985a8de9c4e6562e724?tpId=46&tqId=29030&tPage=1&rp=1&ru=/ta/leetcode&qru=/ta/leetcode/question-ranking 来源:牛客网题目描述: Given a

2017-02-24 23:34:40 403

原创 LeetCode_evaluate-reverse-polish-notation

链接:https://www.nowcoder.com/practice/22f9d7dd89374b6c8289e44237c70447?tpId=46&tqId=29031&tPage=1&rp=1&ru=/ta/leetcode&qru=/ta/leetcode/question-ranking 来源:牛客网题目描述: Evaluate the value of an arithmetic

2017-02-23 23:22:39 437

原创 LeetCode_rotate-image

链接:https://www.nowcoder.com/profile/1503/codeBookDetail?submissionId=9042883 来源:牛客网题目描述: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow u

2017-02-22 23:24:20 370

原创 LeetCode_container-with-most-water

链接:https://www.nowcoder.com/practice/c97c1400a425438fb130f54fdcef0c57?tpId=46&tqId=29167&tPage=1&rp=1&ru=/ta/leetcode&qru=/ta/leetcode/question-ranking 来源:牛客网题目描述: Given n non-negative integers a1, a

2017-02-20 23:52:16 420

原创 LeetCode_504. Base 7

504. Base 7Given an integer, return its base 7 string representation. Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input wil be in range of [-1e7, 1e7].解题思路: 题意:将十进制数

2017-02-18 13:06:54 868

转载 图像重叠区域

http://www.cnblogs.com/dwdxdy/archive/2013/08/02/3232331.html

2017-02-12 16:56:26 4073

转载 深度学习性能提升的诀窍

http://www.36dsj.com/archives/64348

2017-02-12 16:55:48 329

转载 sfm

http://m.blog.csdn.net/article/details?id=46237197 http://blog.csdn.net/sway_2012/article/details/8036863

2017-02-12 16:54:02 1675

转载 单应矩阵

http://m.blog.csdn.net/article/details?id=52319491 http://blog.csdn.net/yjl9122/article/details/50972320 http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/features2d/feature_homography/feat

2017-02-12 16:52:45 453

转载 vector初始化

简介: vector可用于替代C中的数组,或者MFC中的CArray,从许多说明文档或者网上评论,一般一致认为应该优先选择vector,因为它的效率更高,而且具备很好的异常安全性。 而且vector是STL推荐使用的默认容器,除非有特殊需要,如需要容器在head和tail高效的插入和删除,或者在任何位置高效的插入和删除,那么此时使用vector不能满足需求,可能使用deque或者list更加合适

2017-02-12 12:07:57 652 1

原创 LeetCode_448. Find All Numbers Disappeared in an Array

448. Find All Numbers Disappeared in an ArrayGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusi

2017-02-12 11:05:59 298

原创 LeetCode_387. First Unique Character in a String

387. First Unique Character in a String Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = "leetcode"return 0.s = "lovelee

2017-02-03 22:02:03 243

转载 C++中的unique函数

STL中的unique函数的头文件:#include<iostream>unique 的作用是“去掉”容器中相邻元素的重复元素,这里所说的“去掉”并不是真正把重复元素删除,它实质上是一个伪去除,是把重复的元素移到后面去了,然后依然保存到了原数组中,然后返回去重后最后一个元素的地址。 因为unique去除的是相邻元素的重复元素,所以使用之前需要排序。sort, unique和erase的联合使用,可

2017-02-03 21:06:29 957 2

原创 LeetCode_349. Intersection of Two Arrays

349. Intersection of Two Arrays Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: 1. Each element in the result m

2017-02-03 20:44:50 291

原创 LeetCode_383. Ransom Note

383. Ransom Note: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from

2017-02-03 19:10:58 321

原创 LeetCode_453. Minimum Moves to Equal Array Elements

453. Minimum Moves to Equal Array Elements Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 ele

2017-02-01 18:07:09 277

原创 LeetCode_455. Assign Cookies

455. Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the m

2017-02-01 17:30:44 287

原创 LeetCode_283. Move Zeroes

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.For example, given nums = [0, 1, 0, 3, 12], after

2017-02-01 16:20:49 444

原创 LeetCode_167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers suc

2017-01-31 21:31:39 334

转载 LeetCode_258. Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, r

2017-01-31 20:44:55 266

原创 LeetCode_371. Sum of Two Integers

371. Sum of Two Integers Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.解题思路:既然不能用内置的加减法,那就只能用位运算。 xor:可理解为不考

2017-01-31 17:48:19 264

原创 LeetCode_492. Construct the Rectangle

492. Construct the Rectangle For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now is to design a rectang

2017-01-30 11:46:25 856

原创 LeetCode_292. Nim Game

292. Nim Game You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last sto

2017-01-30 10:53:29 313

原创 LeetCode_136. Single Number

136. Single Number Given an 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 wi

2017-01-30 10:26:06 293

转载 LeetCode_463. Island Perimeter

463. Island Perimeter You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). T

2017-01-28 20:50:11 282

原创 LeetCode_485. Max Consecutive Ones

485. Max Consecutive Ones Given a binary array, find the maxumum number of consecutive 1s in this array. Example 1Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three di

2017-01-26 11:55:13 326

原创 LeetCode_344. Reverse String

344. Reverse String Write a function that takes a string as input and returns the string reversed.Example Given s=”hello”, return “olleh”. C++:class Solution{public: string reverseString(string

2017-01-24 21:33:49 284

原创 LeetCode_476. Number Complement

476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: 1. The given integer is guanteed to fit w

2017-01-24 17:17:13 645

原创 matlab读寫文件--bin/txt/csv

fid = fopen('Asave.bin', 'wb');fwrite(fid, A, 'single');fclose(fid);fidtest = fopen('Asave.bin', 'r');while ~feof(fidtest) dataTen = fread(fidtest, 1, 'single');endMarkdown和扩展Markdown简洁的语法代码

2016-10-23 20:56:24 2166

转载 SIFT特征提取与匹配

ps:看过的东西老是不记得,还是多整理整理,加深理解。http://blog.csdn.net/zddblog/article/details/7521424 http://blog.csdn.net/abcjennifer/article/details/7639681一. 综述SIFT(Scale-invariant feature transform)是一种检测局部特征的算法,该算法通过求一

2016-10-18 23:21:27 696

转载 numpy array transpose

array转置

2016-08-29 19:49:27 672

空空如也

空空如也

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

TA关注的人

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