- 博客(194)
- 资源 (3)
- 收藏
- 关注
原创 1055. The World's Richest (25)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl
2015-03-10 15:44:40 1180 4
原创 1054. The Dominant Color (20)
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the d
2015-03-10 10:32:07 594
原创 1080. Graduate Admission (30)
It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admissio
2015-03-06 21:41:14 671
原创 1079. Total Sales of Supply Chain (25)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on
2015-03-06 15:43:55 574
原创 1078. Hashing (25)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be "H(key) = key %
2015-03-05 21:04:56 1055
原创 1077. Kuchiguse (20)
The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called
2015-03-05 16:54:51 1040
原创 1004. Counting Leaves (30)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with
2015-03-05 15:41:31 902
原创 1002. A+B for Polynomials (25)
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a p
2015-03-03 15:58:58 529
原创 1001. A+B Format (20)
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file cont
2015-03-03 10:36:55 1387
原创 2015计划
2015新年计划不知不觉又来到了新的一年,以前也想过写新年计划,不过只是一个念头,从来没有真正认真思考,自己这一年到底要做些什么,总是等到事情来了才去做,这也是自己一个很大的毛病吧!只有目标,只想自己要什么,而没有具体的实施计划也是徒劳的,因此今年的计划书上会有具体的一些实施方案。 2015来了,而我只有半年的时间继续我的大学生活,马上就要毕业了,以前总觉得毕业很遥远,可是疏忽间
2015-03-02 21:03:34 764 1
原创 c++不通过中间变量交换两个变量的值
在c++中,如果需要交换两个变量的值,通常的做法是利用一个中间变量暂存其中一个变量的值。如果不用中间变量,有两种方法,一是通过四则运算,二是通过异或运算,异或运算可以通过逻辑推倒。具体如下:#includeusing namespace std;int main(){ //通过加减运算 int a = 5; int b = 6; a = a + b; b = 2
2015-03-02 10:26:07 2625
原创 快速排序改进算法
#includeusing namespace std;const int M = 20;void quickSort(int *data,const int left,const int right);int partition(int *data,const int low,const int high);void insertSort(int *data,const int le
2014-09-13 23:35:37 2011
原创 c++中 int 和 string 的相互转换
/**************************************************author: Andrewseudate: 2014.8.8**************************************************/#include#include#includeusing namespace std;int main(){
2014-08-09 21:13:12 996
原创 Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".一开始想到的fangd
2014-08-09 19:37:01 1489
原创 String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input case
2014-08-09 15:40:59 1534
转载 VS2013常用快捷键
VS2013常用快捷键: 1.回到上一个光标位置/前进到下一个光标位置 1)回到上一个光标位置:使用组合键“Ctrl + -”; 2)前进到下一个光标位置:“Ctrl + Shift + - ”。 2.复制/剪切/删除整行代码 1)如果你想复制一整行代码,只需将光标移至该行,再使用组合键“Ctrl+C”来完成复制操作,而无需选择整行。 2)如果你想剪
2014-08-09 09:59:29 783
原创 关于实习的一点感想
走出公司的大门,实习也就告一段落了。6.24到8.8号,一个半月左右的时间。感受了一下工作的气氛,解除了一下这个行业的人,对这个行业加深了一些认识,同时也学了一些新的技术。还记得入职的第一天,因为我前一天下午才结束大学最后一门的期末考试---计算机网络概论。考完第二天,带着一点儿小期待,就愉快的去上班了。其实提前一个星期就知道这个消息了,当时还跟人力提要求说能不能休息几天再去,结果公司还是没有
2014-08-08 23:54:48 1485 1
原创 Implement strStr()
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
2014-07-20 23:44:54 744
原创 Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a pa
2014-07-20 20:55:04 933
原创 Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total
2014-06-06 10:52:57 888
原创 Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If t
2014-06-06 10:12:26 807
原创 Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.
2014-06-05 21:23:31 3722
原创 Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \
2014-06-05 14:33:39 802
原创 Path Sum
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.For example:Given the below binary tree and sum
2014-06-05 10:42:08 707
原创 Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.这个就比较jia
2014-06-05 10:21:51 1081
原创 Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.yi
2014-06-05 10:09:38 1150
原创 Binary Tree Zigzag Level Order Traversal
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 alternate between).For example:Given binary
2014-05-30 20:50:42 2976
原创 Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solution is t
2014-05-30 20:01:03 1035
原创 Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to {1,4
2014-05-27 20:42:10 719
原创 Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?
2014-05-27 19:27:11 654
原创 Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Have you b
2014-05-27 17:07:32 706
原创 Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题目yao
2014-05-27 16:19:36 2443
原创 Deep copy(深拷贝)和shallow copy(浅拷贝)的区别
deep copy 和shallow copy 都是用于对象之间的拷贝,简单来说,如果
2014-05-24 18:03:41 11199
原创 Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
2014-05-24 17:26:04 877
转载 9个offer,12家公司,35场面试,从微软到谷歌
1, 简介毕业答辩搞定,总算可以闲一段时间,把这段求职经历写出来,也作为之前三个半月的求职的回顾。 首先说说我拿到的offer情况:1) 微软,3面->终面,搞定(+1)2) 百度,3面->终面,口头offer(+1)3) 搜狗,2面,悲剧4) 腾讯,1面,悲剧5) 布丁移动,3面,搞定(+1)6) 涂鸦游戏,3面,搞定(+1)
2014-05-23 22:12:54 3303
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人