上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 44 下一页
摘要: 6.4 A bunch of people are living on an island, when a visitor comes with a strange order: all blue-eyed people must leave the island as soon as possib... 阅读全文
posted @ 2015-08-24 06:59 Grandyang 阅读(1180) 评论(0) 推荐(0) 编辑
摘要: 6.3 You have a five-quart jug, a three-quart jug, and an unlimited supply of water (but no measuring cups). How would you come up with exactly four qu... 阅读全文
posted @ 2015-08-24 06:28 Grandyang 阅读(1035) 评论(0) 推荐(0) 编辑
摘要: 6.2 There is an 8x8 chess board in which two diagonally opposite corners have been cut off. You are given 31 dominos, and a single domino can cover ex... 阅读全文
posted @ 2015-08-24 06:13 Grandyang 阅读(776) 评论(0) 推荐(0) 编辑
摘要: 6.1 You have 20 bottles of pills. 19 bottles have 1.0 gram pills, but one has pills of weight 1.1 grams. Given a scale that provides an exact measurem... 阅读全文
posted @ 2015-08-24 04:57 Grandyang 阅读(643) 评论(0) 推荐(0) 编辑
摘要: 5.8 A monochrome screen is stored as a single array of bytes, allowing eight consecutive pixels to be stored in one byte.The screen has width w, where 阅读全文
posted @ 2015-08-23 10:51 Grandyang 阅读(1035) 评论(0) 推荐(0) 编辑
摘要: 在C++中,unsigned char用来表示一个字节,也就是8位大小的值,那么我们如何来打印出其值呢,用cout直接打印会乱码,我们可以通过下面两种方法来打印:cout (screen[i]) << endl;printf("%u\n", screen[i]); 阅读全文
posted @ 2015-08-22 07:52 Grandyang 阅读(1630) 评论(0) 推荐(0) 编辑
摘要: http://www.pearltrees.com/t/kinect-capture-scanner/id2814260 阅读全文
posted @ 2015-08-22 00:11 Grandyang 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 5.7 An array A contains all the integers from 0 to n, except for one number which is missing. In this problem, we cannot access an entire integer in A... 阅读全文
posted @ 2015-08-21 11:42 Grandyang 阅读(2154) 评论(0) 推荐(0) 编辑
摘要: 5.6 Write a program to swap odd and even bits in an integer with as few instructions as possible (e.g., bit 0 and bit 1 are swapped, bit 2 and bit 3 a... 阅读全文
posted @ 2015-08-20 06:56 Grandyang 阅读(1198) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Note: Hint: 这道题是之前那 阅读全文
posted @ 2015-08-19 23:28 Grandyang 阅读(30460) 评论(11) 推荐(3) 编辑
摘要: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example 阅读全文
posted @ 2015-08-19 13:14 Grandyang 阅读(23225) 评论(2) 推荐(2) 编辑
摘要: 在Qt程序调试的时候,经常需要打印一些变量,那么我们就需要使用qDebug()函数,这种函数有两种使用方法,如下所示:QString s = "Jack";qDebug() << "My name is " << s << ", nice to meet you!" << endl;qDebug("... 阅读全文
posted @ 2015-08-19 10:41 Grandyang 阅读(83611) 评论(2) 推荐(3) 编辑
摘要: Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements tha 阅读全文
posted @ 2015-08-19 00:42 Grandyang 阅读(21822) 评论(15) 推荐(3) 编辑
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Follow up:Could you do it without any lo 阅读全文
posted @ 2015-08-18 23:36 Grandyang 阅读(15934) 评论(6) 推荐(2) 编辑
摘要: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5" 阅读全文
posted @ 2015-08-17 22:45 Grandyang 阅读(14294) 评论(5) 推荐(0) 编辑
摘要: OpenCV中的CvArr*的定义的一个空类型的指针,可以转换为其派生类CvMat和IplImage,那么如何将其转化为cv::Mat呢,其实很简单,只需要一行代码即可:// CvArr *_imgcv::Mat img = cv::cvarrToMat(_img); 阅读全文
posted @ 2015-08-15 10:46 Grandyang 阅读(6493) 评论(0) 推荐(0) 编辑
摘要: 在OpenCV中,比较常见的是矩形遮罩CvRect,没有专门提供圆形的mask,那么我们只能自己写一个来模拟圆形mask的函数,需要提供的参数为原图的大小,以及圆形mask的圆心位置和半径即可,返回一个cv::Mat型的mask,参见代码如下:// C APIcv::Mat extractCircu... 阅读全文
posted @ 2015-08-15 09:51 Grandyang 阅读(2913) 评论(0) 推荐(0) 编辑
摘要: 5.5 Write a function to determine the number of bits required to convert integer A to integer B.EXAMPLEInput: 31,14Output: 2 这道题给了我们两个数字A和B,问如果将A转化为B需 阅读全文
posted @ 2015-08-14 15:54 Grandyang 阅读(637) 评论(0) 推荐(0) 编辑
摘要: 5.4 Explain what the following code does: ((n & (n-1)) == 0).这道题让我们解释一个表达式((n & (n-1)) == 0),是说一个数跟比它小1的数字按位相与,结果全是0的情况,那么说明两个数每个位置上至少都有一个0,那么最有可能的情况是... 阅读全文
posted @ 2015-08-13 22:33 Grandyang 阅读(718) 评论(0) 推荐(0) 编辑
摘要: 5.3 Given a positive integer, print the next smallest and the next largest number that have the same number of 1 bits in their binary representation. 阅读全文
posted @ 2015-08-12 21:12 Grandyang 阅读(583) 评论(0) 推荐(0) 编辑
摘要: 5.2 Given a real number between 0 and 1 (e.g., 0.72) that is passed in as a double, print the binary representation. If the number cannot be represent... 阅读全文
posted @ 2015-08-11 15:02 Grandyang 阅读(771) 评论(0) 推荐(0) 编辑
摘要: 5.1 You are given two 32-bit numbers, N and M, and two bit positions, land j. Write a method to insert M into N such that M starts at bit j and ends a... 阅读全文
posted @ 2015-08-10 09:05 Grandyang 阅读(803) 评论(0) 推荐(0) 编辑
摘要: Matlab是矩阵运算的神器,所以可以很轻易的交换任意行或列,而且写法非常简洁,如下所示:a = [1 2 3; 4 5 6; 7 8 9];b = a;b(:,[1;2]) = b(:,[2;1]); % Swap col 1 and 2c = a;c([1;2],:) = c([2;1],:);... 阅读全文
posted @ 2015-08-09 11:32 Grandyang 阅读(3588) 评论(0) 推荐(0) 编辑
摘要: 4.9 You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum to a given value. The path does 阅读全文
posted @ 2015-08-09 10:05 Grandyang 阅读(1103) 评论(3) 推荐(0) 编辑
摘要: 在MatLab中,我们有时要给画出的点按一定顺序标上序号,下面这个简单的例子实现这个功能:x=rand(1,10);y=rand(1,10);plot(x,y,'r*');text(x+0.02,y,num2cell(1:10)); 阅读全文
posted @ 2015-08-09 07:06 Grandyang 阅读(2703) 评论(0) 推荐(0) 编辑
摘要: 4.8 You have two very large binary trees: Tl, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree... 阅读全文
posted @ 2015-08-08 11:03 Grandyang 阅读(689) 评论(0) 推荐(0) 编辑
摘要: 4.7 Design an algorithm and write code to find the first common ancestor of two nodes in a binary tree. Avoid storing additional nodes in a data struc... 阅读全文
posted @ 2015-08-07 23:28 Grandyang 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 4.6 Write an algorithm to find the'next'node (i.e., in-order successor) of a given node in a binary search tree. You may assume that each node has a l... 阅读全文
posted @ 2015-08-06 23:26 Grandyang 阅读(1189) 评论(0) 推荐(0) 编辑
摘要: 一、Matlab绘图中用到的直线属性包括:(1)LineStyle:线形(2)LineWidth:线宽(3)Color:颜色(4)MarkerType:标记点的形状(5)MarkerSize:标记点的大小(6)MarkerFaceColor:标记点内部的填充颜色(7)MarkerEdgeColor:... 阅读全文
posted @ 2015-08-05 11:34 Grandyang 阅读(5123) 评论(0) 推荐(0) 编辑
摘要: 我们在使用OpenCV时,有时候需要对现有图片剪裁,比如只需要一个小窗口中的内容,那么我们可以通过OpenCV的兴趣区域 Region of Interest (ROI) 来很轻易的实现,操作也很简单,首先建立一个新的IplImage图片,大小为你需要剪裁出来的大小,然后建立一个该大小的CvRect... 阅读全文
posted @ 2015-08-04 11:48 Grandyang 阅读(3296) 评论(0) 推荐(0) 编辑
摘要: 4.5 Implement a function to check if a binary tree is a binary search tree.LeetCode上的原题,请参见我之前的博客Validate Binary Search Tree 验证二叉搜索树。 阅读全文
posted @ 2015-08-03 23:38 Grandyang 阅读(584) 评论(0) 推荐(0) 编辑
摘要: 希爾頓:蘇梅島,馬爾地夫,大溪地 Bora Bora ,夏威夷茂宜島。凱悅:馬爾地夫,夏威夷茂宜島,Cancun。洲際:大溪地 Bora Bora,蘇梅島。費爾蒙:Cancun,加拿大,夏威夷茂宜島,百慕達卡爾森:倫敦,巴黎,其他歐洲。 阅读全文
posted @ 2015-08-03 06:11 Grandyang 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 1.传统方法-搜!所熟知的美国订票三大门户网站: Orbitz, Travelocity & Expedia,以及美国订票超级aggregator: Kayak, Mobissimo, SideStep, FareChase. 然后这不是重点....Booking Buddy强大的搜索小帮手,只用输... 阅读全文
posted @ 2015-08-03 01:33 Grandyang 阅读(1404) 评论(0) 推荐(0) 编辑
摘要: 我们有时候在项目中需要将OpenCV中的cv::Mat导入MatLab进行分析与处理,那么如果把数据转过去呢,我们的做法是首先将cv::Mat导出为txt文件,或者是yml文件,请参见我之前的博客Write cv::Mat to a file。导出的txt文件可以直接load进MatLab,如果数据... 阅读全文
posted @ 2015-08-02 07:42 Grandyang 阅读(1110) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = ... 阅读全文
posted @ 2015-08-02 01:07 Grandyang 阅读(14423) 评论(5) 推荐(2) 编辑
摘要: 4.4 Given a binary tree, design an algorithm which creates a linked list of all the nodes at each depth (e.g., if you have a tree with depth D, you'll... 阅读全文
posted @ 2015-08-01 23:21 Grandyang 阅读(563) 评论(0) 推荐(0) 编辑
摘要: 4.3 Given a sorted (increasing order) array with unique integer elements, write an algorithm to create a binary search tree with minimal height.这道题给了我... 阅读全文
posted @ 2015-07-31 23:24 Grandyang 阅读(729) 评论(0) 推荐(0) 编辑
摘要: 4.2 Given a directed graph, design an algorithm to find out whether there is a route between two nodes.LeetCode和CareerCup中关于图的题都不是很多,LeetCode中只有三道,分别是... 阅读全文
posted @ 2015-07-30 23:50 Grandyang 阅读(1071) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://blog.sina.com.cn/s/blog_ad7c19000102v42d.html一. 图形学、可视化领域的会议:(一)高级别会议1. Siggraph (图形学领域最高级别会议,不知SCI收录否。国内研究者除非结果特牛,轻易别投)2. Eurograph (作为Co... 阅读全文
posted @ 2015-07-30 06:22 Grandyang 阅读(2010) 评论(0) 推荐(0) 编辑
摘要: 4.1 Implement a function to check if a binary tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that t... 阅读全文
posted @ 2015-07-29 13:11 Grandyang 阅读(781) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 44 下一页
Fork me on GitHub