- 博客(27)
- 收藏
- 关注
转载 django 下载文件的几种方法
转自:http://blog.sciencenet.cn/blog-47522-664541.htmldjango 下载文件的几种方法from:http://oldj.net/article/django-big-file-response/from:http://www.douban.com/group/topic/17856825/from:http://hi.
2015-01-30 00:15:33 23894 2
转载 How does HTTP file upload work?
转自:http://stackoverflow.com/questions/8659808/how-does-http-file-upload-workStack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no r
2015-01-28 23:03:20 1249
转载 明星群众问题
转自:http://www.cnblogs.com/legendmaner/archive/2013/05/24/3097248.html阿里的题目:有n-1个群众和1个明星,群众两两间可能认识也可能不认识,但是群众都认识明星,明星不认识其他任何人。现在每次询问一个人是否认识另一个人的时间复杂度是O(1),要求找出明星的时间复杂度。笔试时,完全不知道在写什么。题目似乎都
2015-01-28 13:09:09 1291
转载 Maximum size square sub-matrix with all 1s
转自:http://www.geeksforgeeks.org/maximum-size-sub-matrix-with-all-1s-in-a-binary-matrix/是找大的全1的正方形感觉像是找最小编辑距离一样Maximum size square sub-matrix with all 1sGiven a binary
2015-01-28 00:26:35 639
转载 Inorder Tree Traversal without recursion and without stack!
http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion-and-without-stack/思想是用当前节点的左子树的最右子结点指向自己,如果当前节点的左子树没有右子树,则当前节点的左子树的右指针指向当前节点,这样可以实现回溯Using Morris Traversal, we can tr
2015-01-28 00:09:06 461
原创 打印配对括号
#include #include using namespace std;void printParenthesis(int n,int left, int right,int idx, char *output){ if (left == n && right == n) { for (int
2015-01-27 23:42:21 403
转载 Given an array [a1b2c3d4] convert to [abcd1234] with 0(1) space and O(n) time
从 a1b2c3d4 --> abcd1234voidconvertArray(char* array, intlength) {inti;if(length >=4) {convertArray(array, length/2);convertArray(array + length/2, length/2);for(i=0; i4; i++)
2015-01-27 23:21:33 1634
转载 重要 Dynamic Programming | Set 25 (Subset Sum Problem)
转自:http://www.geeksforgeeks.org/dynamic-programming-subset-sum-problem/Given a set of non-negative integers, and a value sum, determine if there is a subset of the given set with sum equal to gi
2015-01-27 22:49:59 582
原创 Print all possible strings of length k that can be formed from a set of n characters
Given a set of characters and a positive integer k, print all possible strings of length k that can be formed from the given set.Examples:Input: set[] = {'a', 'b'}, k = 3Output:aaaaababaabbb
2015-01-26 19:16:16 570
转载 Sort a linked list of 0s, 1s and 2s
转自:http://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/这道题有点和正常的思路不一样,不过挺好Sort a linked list of 0s, 1s and 2sGiven a linked list of 0s, 1s and 2s, sort it.Sour
2015-01-26 18:57:38 461
转载 Controlling How NSThread and NSRunLoop Exit
转自:http://shaheengandhi.com/controlling-thread-exit/Controlling How NSThread and NSRunLoop ExitWhile most concurrency can be dealt with by using GCD dispatch queues, there are some thing
2015-01-26 13:16:47 615
转载 Program to print last 10 lines
转自:http://www.geeksforgeeks.org/print-last-10-lines-of-a-given-file/Given some text lines in one string, each line is separated by ‘\n’ character. Print the last ten lines. If number of line
2015-01-25 23:22:29 399
转载 Add two numbers represented by linked lists | Set 2
转自: http://www.geeksforgeeks.org/sum-of-two-linked-lists/Given two numbers represented by two linked lists, write a function that returns sum list. The sum list is linked list representation
2015-01-25 00:17:10 423
转载 Find duplicates in O(n) time and O(1) extra space
转自:http://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/思想是用元素的值作为下标Find duplicates in O(n) time and O(1) extra spaceGiven an array of n element
2015-01-24 23:30:03 616
转载 Print all nodes that are at distance k from a leaf node
转自:http://www.geeksforgeeks.org/print-nodes-distance-k-leaf-node/Given a Binary Tree and a positive integer k, print all nodes that are distance k from a leaf node.Here the meaning of di
2015-01-18 23:31:36 601
转载 Given an infinite size array with only 0s and 1s and sorted. find the transition point where 0s end
转自 :http://www.careercup.com/question?id=9691840Amazon Interview Question Software Engineer / Developers0of 0 votes27 AnswersGiven an infinite size
2015-01-18 23:27:18 443
转载 next-greater-element
转自:http://www.geeksforgeeks.org/next-greater-element/Next Greater ElementGiven an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an eleme
2015-01-18 22:50:49 462
转载 等概率随机函数的实现
转自:http://blog.csdn.net/doc_sgl/article/details/10791121我们知道在C语言中有rand()函数可以提供随机数,rand()函数的范围为0到32727。我们假定认为rand()产生的随机数在0到32727范围内是等概率的。如果我们需要得到一个小范围内的随机数,比如0到55之间的随机数,那我们可以采用rand()%55。但是对于
2015-01-08 12:31:29 731
转载 Dynamic Programming | Set 36 (Maximum Product Cutting)
转自出处: http://www.geeksforgeeks.org/dynamic-programming-set-36-cut-a-rope-to-maximize-product/Given a rope of length n meters, cut the rope in different parts of integer lengths in a way that max
2015-01-07 17:31:34 488
转载 哈希表数组链表表示法示例
转自出处:http://www.cnblogs.com/molixiaoge/archive/2011/12/27/2303201.html#include using namespace std;#define MAXSIZE 10//哈希链表 数组个数 当然可以适当的增加或者减少/*注意点!!! 1.key值一定不能重复的 2.解决地址冲突法 本例用链表解决冲突即闭
2015-01-06 14:25:47 2213
转载 智能指针auto_ptr详解
转自:http://www.cnblogs.com/litterrondo/p/3187342.html主要内容转自http://www.cppblog.com/SmartPtr/archive/2007/07/05/27549.html1. 智能指针auto_ptr的引入auto_ptr是C++标准库中的智能指针模板类,头文件auto_ptr的出现,主
2015-01-06 13:34:50 442
原创 反转链表 (递归法)
ListNode* revertListInt(ListNode* node, ListNode* &newHead){ if (node && node->next) { revertListInt(node->next, newHead)->next = node; } else if (node) { newHead = node; } return node;
2015-01-06 00:26:45 739
转载 Translating Numbers to Strings
转自: http://codercareer.blogspot.com/2014/09/no-55-translating-numbers-to-string.html其实这道题就是 leetcode中的decode wayQuestion: Given a number, please translate it to a string, following the
2015-01-05 22:43:53 450
转载 Design a stack with operations on middle element
How to implement a stack which will support following operations in O(1) time complexity?1) push() which adds an element to the top of stack.2) pop() which removes an element from top of stack.3
2015-01-05 22:21:24 523
原创 Tree Isomorphism Problem
Write a function to detect if two trees are isomorphic. Two trees are called isomorphic if one of them can be obtained from other by a series of flips, i.e. by swapping left and right children of a nu
2015-01-05 22:03:04 821
转载 Find distance between two given keys of a Binary Tree
Find the distance between two keys in a binary tree, no parent pointers are given. Distance between two nodes is the minimum number of edges to be traversed to reach one node from other.另外请参考:
2015-01-05 21:46:22 427
转载 Given an array of ages (integers) sorted lowest to highest, output the number of occurrences for eac
转自: http://www.careercup.com/question?id=5129701993480192Given an array of ages (integers) sorted lowest to highest, output the number of occurrences for each age. For instance: [8,8,8,9,9,1
2015-01-02 12:25:10 701
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人