摘要: 用OpenCV同时显示两个摄像头的内容的代码如下:#include #include #include #include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]) { CvCapture... 阅读全文
posted @ 2015-02-27 04:48 Grandyang 阅读(3702) 评论(0) 推荐(0) 编辑
摘要: 在做项目中,我们经常需要获取系统的当前时间,那么如何获取呢,参见下面的代码:/* asctime example */#include /* printf */#include /* time_t, struct tm, time, localtime, asctime *... 阅读全文
posted @ 2015-02-27 01:55 Grandyang 阅读(20173) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], 阅读全文
posted @ 2015-02-26 13:16 Grandyang 阅读(22708) 评论(9) 推荐(3) 编辑
摘要: :-) smile:-] polite smile:-( frown:-[ another frown:-/ or :-\ skepticism, annoyance, or a slight frown:-| indecision, deadpan, or indifference; also o... 阅读全文
posted @ 2015-02-26 06:50 Grandyang 阅读(10088) 评论(0) 推荐(0) 编辑
摘要: Qt中的信号槽系统是不同类中间传递数据的神器,如果连接父子空间之间的信号槽很重要,在父类中实例化子类的时候一定要注意将父类连上,不然信号槽无法使用,比如若子类是个对话框Dialog类,一定不要忘了加thisQtClass *qc = new QtClass(this);qc->exec();然后如果... 阅读全文
posted @ 2015-02-26 05:41 Grandyang 阅读(2577) 评论(0) 推荐(1) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example: Input: 3 Output: 5 Explanation: Given n = 3, the 阅读全文
posted @ 2015-02-25 14:56 Grandyang 阅读(23932) 评论(4) 推荐(4) 编辑
摘要: Qt中的Label标签控件的作用绝不仅仅限于显示静态文本,其实它的功能很强大,由于其有setPixmap()成员函数,故而可以当显示图片窗口使用,而且还可以实时显示摄像头捕获的图片,然后它对鼠标事件的支持却没有QWidget那样强大,很多时候我们想要QLabel捕获鼠标单击或双击的事件,它本身无法实 阅读全文
posted @ 2015-02-25 01:41 Grandyang 阅读(3346) 评论(0) 推荐(0) 编辑
摘要: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Note: Try to come up as many solutions as you 阅读全文
posted @ 2015-02-24 15:13 Grandyang 阅读(32792) 评论(15) 推荐(2) 编辑
摘要: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac" Output: 阅读全文
posted @ 2015-02-24 14:03 Grandyang 阅读(17663) 评论(14) 推荐(3) 编辑
摘要: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2015-02-24 02:26 Grandyang 阅读(34870) 评论(17) 推荐(2) 编辑
摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2 阅读全文
posted @ 2015-02-23 15:13 Grandyang 阅读(22327) 评论(8) 推荐(4) 编辑
摘要: Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive so 阅读全文
posted @ 2015-02-22 05:51 Grandyang 阅读(34891) 评论(11) 推荐(8) 编辑
摘要: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2015-02-21 14:55 Grandyang 阅读(14464) 评论(7) 推荐(0) 编辑
摘要: Ctrl-CCopyCtrl-XCutCtrl-VPasteCtrl-ZUndoCtrl-YRedoCtrl-ASelect AllCtrl-FLaunch Find DialogCtrl-HLaunch Find / Replace DialogCtrl-DDuplicate Current ... 阅读全文
posted @ 2015-02-21 02:42 Grandyang 阅读(748) 评论(0) 推荐(0) 编辑
摘要: 在使用Qt和OpenCV编程时,对于它们各自的图像类QImage和IplImage难以避免的需要互相之间的转换,下面我们就来看它们的相互转换。1. QImage 转换为 IplImageIplImage *QImageToIplImage(const QImage * qImage){ int... 阅读全文
posted @ 2015-02-21 01:46 Grandyang 阅读(2061) 评论(0) 推荐(0) 编辑
摘要: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, 阅读全文
posted @ 2015-02-20 13:52 Grandyang 阅读(19937) 评论(5) 推荐(2) 编辑
摘要: 在Qt中经常需要弹出窗口,QMessageBox可以实现此功能,一共有三种窗口,information, question, 和 warning,critical, about分别对应感叹号,问号和叉号等等,使用方法很简单,一共有三个参数,第一个是父窗口句柄,剩下两个分别为窗口名称和显示内容,显示内... 阅读全文
posted @ 2015-02-20 07:13 Grandyang 阅读(14660) 评论(0) 推荐(0) 编辑
摘要: Qt5从Qt4升级后,很多原来Qt4中定义的函数或者变量由于种种原因在Qt5中被遗弃,所以用Qt5来编译Qt4的一些工程项目时,难以避免的会需要修改一些地方,下面就罗列一些我遇到的一些需要修改的地方:- Qt5中UnicodeUTF8不再是QCoreApplication的一个成员,所以下面的代码需... 阅读全文
posted @ 2015-02-20 05:11 Grandyang 阅读(5701) 评论(0) 推荐(0) 编辑
摘要: Go to Linker -> General -> Additional LIbrary Directories:qtmaind.libQt5Cored.libQt5Guid.libQt5Widgetsd.libQt5Multimediad.libQt5MultimediaWidgetsd.lib 阅读全文
posted @ 2015-02-20 03:16 Grandyang 阅读(282) 评论(0) 推荐(0) 编辑
摘要: Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, 阅读全文
posted @ 2015-02-19 17:29 Grandyang 阅读(14256) 评论(4) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2015-02-18 14:36 Grandyang 阅读(40711) 评论(2) 推荐(2) 编辑
摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文
posted @ 2015-02-18 07:54 Grandyang 阅读(16761) 评论(11) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2015-02-17 14:45 Grandyang 阅读(17113) 评论(6) 推荐(0) 编辑
摘要: 1. leetcodehttp://leetcode.com/2. careeruphttp://www.careercup.com/http://hawstein.com/posts/ctci-solutions-contents.html3. glassdoorhttp://www.glassd... 阅读全文
posted @ 2015-02-17 03:38 Grandyang 阅读(17947) 评论(2) 推荐(0) 编辑
摘要: Given two strings s and t, return the number of distinct subsequences of s which equals t. The test cases are generated so that the answer fits on a 3 阅读全文
posted @ 2015-02-16 14:50 Grandyang 阅读(15758) 评论(11) 推荐(1) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: click to show hints. Hints: If you n 阅读全文
posted @ 2015-02-16 11:07 Grandyang 阅读(22951) 评论(3) 推荐(3) 编辑
摘要: 3DSlicer, a free open source software for visualization and medical image computingAcetoneISO:镜像文件挂载软件Adobe Photoshop Album, an image organizing appli... 阅读全文
posted @ 2015-02-14 00:42 Grandyang 阅读(8553) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there 阅读全文
posted @ 2015-02-13 13:51 Grandyang 阅读(18609) 评论(14) 推荐(1) 编辑
摘要: Qt中的表单控件QListWidget类提供了许多信号函数,可以和用户交互,其中有个currentRowChanged ( int currentRow ) 是检测当前选中行是否发生了改变,如果改变了,该信号函数被触发。void QListWidget::currentRowChanged ( in... 阅读全文
posted @ 2015-02-13 04:57 Grandyang 阅读(4344) 评论(0) 推荐(0) 编辑
摘要: 这三个类相互有关联,但是有不尽相同,首先从名字上看,QDir 和 QDirIterator 是针对于文件目录的,也就是文件夹,我们知道,对于一个文件夹,可以包含很多文件,也可以包含其他文件夹,通常是一个树的结构。文件夹里还可以包含符号链接,符号链接是指向其他文件或文件夹的一种链接,和Windows系... 阅读全文
posted @ 2015-02-13 01:56 Grandyang 阅读(4816) 评论(0) 推荐(0) 编辑
摘要: You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following defin 阅读全文
posted @ 2015-02-12 15:07 Grandyang 阅读(17284) 评论(0) 推荐(1) 编辑
摘要: 在Qt中添加按钮或表格控件时需要添加其按键响应,一般来说有两种方法,一种是直接实现其响应函数,第二种是自己写一个响应函数,然后用Qt的信号槽将它们连接起来。愚以为第一种方法更为简单一些。声明这些控件:QPushButton *pbutton;QListWidget *lwidget;然后实现它们的响... 阅读全文
posted @ 2015-02-12 02:16 Grandyang 阅读(3963) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2015-02-11 15:14 Grandyang 阅读(16053) 评论(6) 推荐(1) 编辑
摘要: Qt 支持的图片格式如下:FormatDescriptionQt's supportBMPWindows BitmapRead/writeGIFGraphic Interchange Format (optional)ReadJPGJoint Photographic Experts GroupRe... 阅读全文
posted @ 2015-02-11 05:41 Grandyang 阅读(1541) 评论(0) 推荐(0) 编辑
摘要: 初学Qt的人会经常搞不清这三个图像类QGrphicsView, QGraphicsScene 和 QGraphicsItem,它们到底有什么区别呢?QGrphicsView类实际上是为QGraphicsScene类的内容提空了一个控件,它在一个可滑动视图空间内可视化QGraphicsScene的内容... 阅读全文
posted @ 2015-02-11 05:19 Grandyang 阅读(1500) 评论(0) 推荐(0) 编辑
摘要: The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When study 阅读全文
posted @ 2015-02-10 16:11 Grandyang 阅读(17939) 评论(17) 推荐(1) 编辑
摘要: Qter开源社区http://www.qter.org/[Qt教程], 作者yafeilinux[视频]QT学习之路:从入门到精通 《C++ Qt 编程视频教程》 阅读全文
posted @ 2015-02-10 01:33 Grandyang 阅读(555) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2015-02-09 17:09 Grandyang 阅读(40094) 评论(18) 推荐(1) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2015-02-09 08:39 Grandyang 阅读(28159) 评论(3) 推荐(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 阅读全文
posted @ 2015-02-08 16:12 Grandyang 阅读(22909) 评论(1) 推荐(1) 编辑
Fork me on GitHub