04 2015 档案
摘要:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
阅读全文
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru...
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl...
阅读全文
摘要:自己学了这么久的C语言,但没有写出过什么可以用的东西来,总觉得心里不爽。这几天实在是不想干正事,在网上瞎逛逛,结果发现有人写了连连看的外挂。顿时觉得这很有意思啊。于是把代码下载下来,捣鼓了捣鼓。发现还挺简单的,于是自己研究了一下,仿照着写了一个。外挂的主要思路:获取窗口位置,获取屏幕信息对图片...
阅读全文
摘要:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].二叉树...
阅读全文
摘要:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".For C programmers: Try to solv...
阅读全文
摘要:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
阅读全文
摘要:Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.思路:编程之美里有,就是找因子5的个数。int trail...
阅读全文
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
阅读全文
摘要:Given a range [m, n] where 0 = 0 && ((m & (1 << t)) == (n & (1 << t)))) { ans |= m & (1 << t); t--; } retur...
阅读全文
摘要:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
阅读全文
摘要: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 yo...
阅读全文
摘要:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321总结:处理整数溢出的方法①用数据类型转换long 或 long long②在每次循环时先保存下数字变化之前的值,处理后单步恢复...
阅读全文
摘要:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
阅读全文
摘要:Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p...
阅读全文
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
阅读全文
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
阅读全文
摘要:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
阅读全文
摘要:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
阅读全文
摘要:1. 无重复Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element...
阅读全文
摘要:Jump Game (middle)Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array repr...
阅读全文
摘要:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].思路:开始想用线段树,后来想...
阅读全文
摘要:很郁闷的表示我的opencv放在 D:\\program files 里面路径有个空格,导致我不得不把整个opencv又拷贝到了一个没有空格的路径下面命名为opencvForQt网上有各种用CMake的教程,但实际上没有那么复杂,只要在pro文件里面加入包含文件和库文件即可。即加入下面的语句。我用的...
阅读全文
摘要:折腾了两个小时,太久没用了,找了半天的感觉。先是在视频播放的代码基础上加选择视频的按钮,开始总是显示两个框,后来发现需要用QSplitter来实现同时有多个框的情况。把中心窗口设为这个splitter就可以了:setCentralWidget(splitter); 注意,这里不能用layout.再然...
阅读全文