09 2013 档案

[leetcode.com]算法题目 - Length of Last Word
摘要:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note:A word is defined as a character sequence consists of non-space characters only.For example,Givens="Hello Worl 阅读全文

posted @ 2013-09-25 22:48 Horstxu 阅读(339) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Sqrt(x)
摘要:Implementint sqrt(int x).Compute and return the square root ofx. 1 class Solution { 2 public: 3 int sqrt(int x) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 if(xb)17 return temp;18 else if(temp<a && temp... 阅读全文

posted @ 2013-09-25 21:51 Horstxu 阅读(408) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Sort Colors
摘要:Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are not suppose to use the l 阅读全文

posted @ 2013-09-24 21:32 Horstxu 阅读(415) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Restore IP Addresses
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.255.11.135", "255.255.111.35"]. (Order does not matter)我的答案如下: 1 class Solution { 2 public: 3 4 vector restoreIpAddresses 阅读全文

posted @ 2013-09-24 00:01 Horstxu 阅读(506) 评论(0) 推荐(0) 编辑

[实战演练]2014年人人公司应届生校招技术笔试题
摘要:一,客观题1. 下面哪种排序比较适合对基本有序的数组进行排序()A 插入排序 B 快速排序 C 堆排序 D 归并排序2. 下面哪种排序算法的平均时间复杂度最低()A 快速排序 B 桶排序 C 希尔排序 D 堆排序3. 假设一棵二叉树的后序遍历序列为BJDCFGEIHA,中序遍历序列为BCDJAFEGHI,则其前序遍历序列为()A ACBDEGHJFI B ACBDJHEFGIC ACBDEGJHFI D ABCDEFGHIJ4. 一块矩形巧克力,初始时由N*M个小块组成。每一次你只能把一块巧克力掰成两个小矩形。最少需要几次才能把它们掰成N*M块1*1的小巧克力?A N*M-1 ... 阅读全文

posted @ 2013-09-22 21:08 Horstxu 阅读(1345) 评论(0) 推荐(0) 编辑

[杂谈]笔试中一些数字逻辑推理(非技术)
摘要:在笔试中,技术类岗位一般是一些数据结构,算法,操作系统之类的题目,这也是找工作中的准备重点。不过最近和其他专业的人交流一下,他们的笔试主要考察英语和数学,数学里面其中有一项是数字推理。这部分内容让我想起小学时候经常做过的题目,给出五六个数字,找规律,然后推测出第七个数。总体上感觉这些题目偶尔做做或许可以锻炼一下思维,不过拿它当正事一样天天准备就有点浪费时间的感觉。我的技术笔试中应该不会出现这类题目,不过今天还是饶有兴致的找了一些题目,随便做做吧。(1)3 , 26, (), 72, 95A 42 B 45 C 49 D 54我的答案:C 后一项等于前一项加23(2)-2, 2, -4, ... 阅读全文

posted @ 2013-09-21 23:03 Horstxu 阅读(15109) 评论(0) 推荐(0) 编辑

[实战演练]腾讯2013年校招软件开发类笔试题目(选择题部分)
摘要:该要开始做一下真题了,为了保证在本文中答案的准确性,所有不确定的题目我都已经在网上找到了相关答案。但是百密一疏,这样也不可能保证所有答案都是准确的,不过百分之九十以上应该正确吧。如有不正确的地方,欢迎指正。题目:(一)不定项选择题1. 以下表的设计,最合理的是()A 学生:{id,name,age},学科:{id,name},分数:{学生id,学科id,分数}B 学生:{id,name,age},分数:{学生id,学科名称,分数}C 分数:{学生姓名,学科名称,分数}D 学科:{id,name},分数:{学生姓名,学科id,分数}2. 在数据库系统中,产生不一致的根本原因是()A 数据存储量太 阅读全文

posted @ 2013-09-21 18:29 Horstxu 阅读(1051) 评论(0) 推荐(0) 编辑

[实战演练]史上最长最醒目的队名
摘要:Problem Description Jack所在的班级决定组团报名参加FZU校赛。为了体现班级的团结和睦,班长决定用班级所有人的名字连起来组成一个史上最长最醒目的队名。 因为听说在分数相同的情况下,队名字典序小的会排在更前面,班长还希望连成的史上最长队名拥有最小的字典序。 Input 输入数据第一行包含一个整数T,表示测试数据的组数。对于每组测试数据:第一行为一个整数(10000>=n>0),表示班级成员数。 接下来n行为班级每个人的名字。名字由小写字母组成,每个人名字长度均相同。Output 对于每组测试数据,输出一行,表示连接成的史上最长队名。 Sample Input1 阅读全文

posted @ 2013-09-16 23:01 Horstxu 阅读(1537) 评论(0) 推荐(0) 编辑

[C++基础]队列<queue>中的常用函数
摘要:在C++中只要#include即可使用队列类,其中在面试或笔试中常用的成员函数如下(按照最常用到不常用的顺序)1. push2. pop3. size4. empty5. front6. back接下来逐一举例说明:1. push队列中由于是先进先出,push即在队尾插入一个元素,如:1 queue q;2 q.push("Hello World!");3 q.push("China");4 cout q;2 q.push("Hello World!");3 q.push("China");4 q.pop();5 阅读全文

posted @ 2013-09-14 20:26 Horstxu 阅读(89467) 评论(0) 推荐(10) 编辑

[leetcode.com]算法题目 - Pow(x, n)
摘要:Implement pow(x,n). 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 if (0==n) return 1.0; 7 if (1==n) return x; 8 9 int k = abs(n);10 int rema... 阅读全文

posted @ 2013-09-13 20:11 Horstxu 阅读(496) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Jump Game
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.For example:A =[2,3,1,1,4], returntrue.A =[3,2,1,0,4], returnfalse. 1 阅读全文

posted @ 2013-09-12 21:11 Horstxu 阅读(264) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Pascal's Triangle
摘要: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]] 1 class Solution { 2 public: 3 vector > generate(int numRows) { 4 // Start typing your C/C++ solution below 5 // DO NOT write in... 阅读全文

posted @ 2013-09-12 20:53 Horstxu 阅读(180) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Maximum Subarray
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray[4,−1,2,1]has the largest sum =6. 1 class Solution { 2 public: 3 int maxSubArray(int A[], int n) { 4 // Start... 阅读全文

posted @ 2013-09-11 22:27 Horstxu 阅读(204) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Plus One
摘要:Given a number represented as an array of digits, plus one to the number. 1 class Solution { 2 public: 3 vector plusOne(vector &digits) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 bool allNine = true; 7 int size = digi... 阅读全文

posted @ 2013-09-11 22:18 Horstxu 阅读(244) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Remove Duplicates from Sorted List
摘要:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode 阅读全文

posted @ 2013-09-11 21:53 Horstxu 阅读(261) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Symmetric Tree
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following is not: 1 / \ 2 2 \ \ 3 3Note:Bonus points if you could solve it both recursively and iterati... 阅读全文

posted @ 2013-09-11 20:37 Horstxu 阅读(191) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Decode Ways
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message"12", it cou 阅读全文

posted @ 2013-09-10 00:00 Horstxu 阅读(212) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Gray Code
摘要:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.For example, givenn= 2, return[0,1,3,2]. Its gray code s 阅读全文

posted @ 2013-09-09 22:57 Horstxu 阅读(427) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Same Tree
摘要: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 and the nodes have the same value. 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * Tree... 阅读全文

posted @ 2013-09-09 22:23 Horstxu 阅读(211) 评论(0) 推荐(0) 编辑

[leetcode.com]算法题目 - Triangle
摘要: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 following triangle[ [2], [3,4], [6,5,7], [4,1,8,3]]The minimum path sum from top to bottom is11(i.e.,2+3+5+1= 11).Note:Bonus point if you are a... 阅读全文

posted @ 2013-09-09 19:38 Horstxu 阅读(476) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示