03 2015 档案

摘要:The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return th 阅读全文
posted @ 2015-03-31 13:54 Grandyang 阅读(10121) 评论(2) 推荐(0) 编辑
摘要:The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return al 阅读全文
posted @ 2015-03-30 13:18 Grandyang 阅读(23582) 评论(3) 推荐(0) 编辑
摘要:Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Ex 阅读全文
posted @ 2015-03-30 09:20 Grandyang 阅读(43455) 评论(11) 推荐(1) 编辑
摘要:You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0]. Each element nums[i] represents the maximum len 阅读全文
posted @ 2015-03-28 03:31 Grandyang 阅读(31858) 评论(4) 推荐(2) 编辑
摘要:You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum ju 阅读全文
posted @ 2015-03-27 13:17 Grandyang 阅读(31521) 评论(15) 推荐(2) 编辑
摘要:Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals 阅读全文
posted @ 2015-03-27 02:53 Grandyang 阅读(37602) 评论(21) 推荐(1) 编辑
摘要:You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval 阅读全文
posted @ 2015-03-26 00:59 Grandyang 阅读(22874) 评论(0) 推荐(0) 编辑
摘要:Initializing "cv::StereoBM bm.state->disp12MaxDiff" should be careful, inappropriate value might crash your program. Suggested that you set it to -1 t... 阅读全文
posted @ 2015-03-25 06:11 Grandyang 阅读(939) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: Input: n = 3 Output: [[1,2,3],[8,9, 阅读全文
posted @ 2015-03-24 14:54 Grandyang 阅读(11664) 评论(17) 推荐(0) 编辑
摘要:Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,3,6,9,8,7, 阅读全文
posted @ 2015-03-24 14:22 Grandyang 阅读(26279) 评论(9) 推荐(1) 编辑
摘要:Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1, 阅读全文
posted @ 2015-03-23 14:57 Grandyang 阅读(30318) 评论(10) 推荐(2) 编辑
摘要:Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1: Input: nums = [1,2, 阅读全文
posted @ 2015-03-23 08:29 Grandyang 阅读(54602) 评论(1) 推荐(0) 编辑
摘要:这是Combinations 组合项的延伸,在这里,我们允许不同的顺序出现,那么新的题目要求如下:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4... 阅读全文
posted @ 2015-03-23 07:56 Grandyang 阅读(819) 评论(0) 推荐(0) 编辑
摘要:The set [1, 2, 3, ..., n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the following s 阅读全文
posted @ 2015-03-23 01:44 Grandyang 阅读(22108) 评论(6) 推荐(2) 编辑
摘要:Given the head of a linked list, rotate the list to the right by k places. Example 1: Input: head = [1,2,3,4,5], k = 2 Output: [4,5,1,2,3] Example 2: 阅读全文
posted @ 2015-03-21 13:49 Grandyang 阅读(14960) 评论(5) 推荐(0) 编辑
摘要:cvSave这个函数是OpenCV中用来保存某个数据类型到文件中常用的函数,它原本共有五个参数,但是在VS2010中只需要填前两个,而在Linux必须填满五个,否则会出错,如下:// VS2010cvSave("m.xml", mat);// LinuxcvSave("m.xml", mat, NU... 阅读全文
posted @ 2015-03-21 07:11 Grandyang 阅读(650) 评论(0) 推荐(0) 编辑
摘要:如果我们想把OpenCV中的矩阵数据类型cv::Mat保存在一个文件中,可以使用如下的代码:void writeMatToFile(cv::Mat& m, const char* filename) { ofstream fout(filename); if(!fout) { ... 阅读全文
posted @ 2015-03-20 23:33 Grandyang 阅读(5046) 评论(0) 推荐(0) 编辑
摘要:You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to th 阅读全文
posted @ 2015-03-20 15:13 Grandyang 阅读(16138) 评论(7) 推荐(1) 编辑
摘要:There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-rig 阅读全文
posted @ 2015-03-20 14:30 Grandyang 阅读(22933) 评论(7) 推荐(2) 编辑
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2015-03-20 11:50 Grandyang 阅读(17771) 评论(4) 推荐(3) 编辑
摘要:Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right 阅读全文
posted @ 2015-03-19 14:39 Grandyang 阅读(15910) 评论(3) 推荐(3) 编辑
摘要:Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simpl 阅读全文
posted @ 2015-03-18 14:39 Grandyang 阅读(18529) 评论(8) 推荐(2) 编辑
摘要:Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. 阅读全文
posted @ 2015-03-18 10:10 Grandyang 阅读(30632) 评论(15) 推荐(2) 编辑
摘要:Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations 阅读全文
posted @ 2015-03-17 13:00 Grandyang 阅读(30389) 评论(13) 推荐(2) 编辑
摘要:Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's. You must do it in place. Example 1: Input: matrix = [[ 阅读全文
posted @ 2015-03-16 13:18 Grandyang 阅读(18128) 评论(7) 推荐(0) 编辑
摘要:Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in 阅读全文
posted @ 2015-03-16 10:50 Grandyang 阅读(24743) 评论(6) 推荐(2) 编辑
摘要:Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicat 阅读全文
posted @ 2015-03-16 07:13 Grandyang 阅读(40146) 评论(19) 推荐(0) 编辑
摘要:Download CMake 2.8.12Extract the file, and run "./bootstrap", then "make", then "sudo make install"Add some dependencies, run "sudo apt-get install bu... 阅读全文
posted @ 2015-03-14 08:48 Grandyang 阅读(502) 评论(0) 推荐(0) 编辑
摘要:Download OpenCV 2.4.10Download CMake 2.8Open CMake and choose the source code directory and build binary directoryThen click "Configure", and "Generat... 阅读全文
posted @ 2015-03-14 06:01 Grandyang 阅读(637) 评论(0) 推荐(0) 编辑
摘要:Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n]. You may return the answer in any order. Exampl 阅读全文
posted @ 2015-03-12 15:23 Grandyang 阅读(25462) 评论(8) 推荐(1) 编辑
摘要:Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequent 阅读全文
posted @ 2015-03-12 14:24 Grandyang 阅读(25389) 评论(12) 推荐(1) 编辑
摘要:有时候在项目中我们需要检测当前连接在机子上的摄像头的数量,可以通过下面的代码实现,其中连接摄像头的最大数量maxCamNum可以任意修改:/** * Count current camera number */int countCamera() { int maxCamNum = 5; ... 阅读全文
posted @ 2015-03-12 03:51 Grandyang 阅读(1070) 评论(0) 推荐(0) 编辑
摘要:Add in the system Path:C:\opencv\build\x86\vc10\bin;Project->Project Property->Configuration Properties->VC++Directories ->Include Directories:C:\open... 阅读全文
posted @ 2015-03-12 01:49 Grandyang 阅读(2691) 评论(0) 推荐(0) 编辑
摘要:Qt项目在打包发布之后都需要有个个性的程序图标和窗口图标,这样会使程序更加美观大方,下面我们分别来看如何给程序和窗口分别添加图标。我们需要两种格式的图片,一种是.ico的,用来给程序添加图标,一种是.bmp或是.png的,用来给窗口添加图标。- 程序添加图标如果使用的Qt Creator,那么用记事... 阅读全文
posted @ 2015-03-12 00:43 Grandyang 阅读(8881) 评论(0) 推荐(0) 编辑
摘要:Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The r 阅读全文
posted @ 2015-03-11 11:02 Grandyang 阅读(15353) 评论(5) 推荐(1) 编辑
摘要:Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relati 阅读全文
posted @ 2015-03-11 10:22 Grandyang 阅读(22630) 评论(16) 推荐(0) 编辑
摘要:Download CMake 2.8.2Download OpenCV 2.4.11Download Qt 5.4Highly improtant note: The installation directory should not contain any space or non-English... 阅读全文
posted @ 2015-03-11 04:29 Grandyang 阅读(940) 评论(0) 推荐(0) 编辑
摘要:There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is ro 阅读全文
posted @ 2015-03-10 13:47 Grandyang 阅读(19166) 评论(3) 推荐(0) 编辑
摘要:There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at a 阅读全文
posted @ 2015-03-10 12:34 Grandyang 阅读(44479) 评论(7) 推荐(1) 编辑
摘要:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit 阅读全文
posted @ 2015-03-10 11:11 Grandyang 阅读(9770) 评论(4) 推荐(1) 编辑
摘要:You are given an m x n integer matrix matrix with the following two properties: Each row is sorted in non-decreasing order. The first integer of each 阅读全文
posted @ 2015-03-09 12:53 Grandyang 阅读(15617) 评论(11) 推荐(0) 编辑
摘要:Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matri 阅读全文
posted @ 2015-03-09 06:43 Grandyang 阅读(37388) 评论(9) 推荐(2) 编辑
摘要:Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle 阅读全文
posted @ 2015-03-09 02:38 Grandyang 阅读(50424) 评论(15) 推荐(1) 编辑
摘要:Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 00111001011110000010100101000000 Explanat 阅读全文
posted @ 2015-03-08 10:15 Grandyang 阅读(24420) 评论(5) 推荐(1) 编辑
摘要:Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should p 阅读全文
posted @ 2015-03-08 08:37 Grandyang 阅读(15035) 评论(0) 推荐(2) 编辑
摘要:We can scramble a string s to get a string t using the following algorithm: If the length of the string is 1, stop. If the length of the string is > 1 阅读全文
posted @ 2015-03-06 15:53 Grandyang 阅读(16909) 评论(10) 推荐(1) 编辑
摘要:An n-bit gray code sequence is a sequence of 2n integers where: Every integer is in the inclusive range [0, 2n - 1], The first integer is 0, An intege 阅读全文
posted @ 2015-03-05 13:52 Grandyang 阅读(20252) 评论(3) 推荐(4) 编辑
摘要:以下转换代码摘自维基百科 Wikipedia:/* The purpose of this function is to convert an unsigned binary number to reflected binary Gray code. Th... 阅读全文
posted @ 2015-03-05 13:40 Grandyang 阅读(6950) 评论(0) 推荐(2) 编辑
摘要:C++中的stringstream是专门用来处理字符串流的,可以按顺序将string或int都拼接起来,而不用把int转换为string格式,使用方法如下:#include #include #include stringstream strstream;std::string s;std::str... 阅读全文
posted @ 2015-03-05 10:22 Grandyang 阅读(1090) 评论(0) 推荐(0) 编辑
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: Given a non-empty string containing only digits, determ 阅读全文
posted @ 2015-03-04 15:03 Grandyang 阅读(31547) 评论(13) 推荐(0) 编辑
摘要:这三种数据类型在实际运用中经常需要互相转换,那么这里小结下它们之间的转换方法:- Qstring & stringQt中封装的类十分强大,其成员函数数量之多比STD有过之而无不及,许多程序员抱怨Qt非要整个自己的QTD,为啥不直接支持STD,但是我想说某些时候QTD完全可以替代STD,就算不想完全替... 阅读全文
posted @ 2015-03-04 06:28 Grandyang 阅读(8986) 评论(0) 推荐(1) 编辑
摘要:Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subs 阅读全文
posted @ 2015-03-03 14:57 Grandyang 阅读(20657) 评论(4) 推荐(0) 编辑
摘要:Qt中QComboBox 和 QSpinBox 是两个很常用的空间,QComboBox 是下拉菜单,而 QSpinBox 是调参数的神器,所以它们的用法十分必要熟练掌握。首先来看 QComboBox,这个下拉菜单中的值可以在UI Designer中都设定好,位于第一个位置的就是默认值,也就是程序启动... 阅读全文
posted @ 2015-03-03 04:12 Grandyang 阅读(2687) 评论(0) 推荐(0) 编辑
摘要:Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Retu 阅读全文
posted @ 2015-03-02 17:29 Grandyang 阅读(32566) 评论(8) 推荐(6) 编辑
摘要:Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Out 阅读全文
posted @ 2015-03-01 09:17 Grandyang 阅读(21488) 评论(11) 推荐(1) 编辑

Fork me on GitHub

喜欢请打赏

扫描二维码打赏

Venmo 打赏

点击右上角即可分享
微信分享提示