题目: Evaluate the value of an arithmetic expression
inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an
integer or another e.....
分类:
其他好文 时间:
2014-05-16 05:56:07
阅读次数:
221
题目: Givennpoints on a 2D plane, find the maximum
number of points that lie on the same straight line.解题思路:
第一反应:枚举两个点组成的直线,然后看其他的点在不在这条直线上,在此过程中统计最大.....
分类:
其他好文 时间:
2014-05-16 05:54:57
阅读次数:
193
题目: Sort a linked list inO(nlogn) time using
constant space complexity.解题思路: 复杂度为O(n* logn)
的排序算法有:快速排序、堆排序、归并排序。对于链表这种数据结构,使用归并排序比较靠谱。递归代码如下:代码: /...
分类:
其他好文 时间:
2014-05-16 05:49:04
阅读次数:
266
题目: Sort a linked list using insertion sort.解题思路:
假设 list[1..i]是排好序的,找到第i+1个元素应该插入的位置及其前驱,然后将其插入。代码: /** * Definition for
singly-linked list. * str...
分类:
其他好文 时间:
2014-05-16 05:47:08
阅读次数:
258
题目: Given an input string, reverse the string word
by word. For example, Given s = "the sky is blue", return "blue is sky
the".解题思路: 1、先对字符串进行一次总...
分类:
其他好文 时间:
2014-05-16 05:44:30
阅读次数:
263
剑指offer第12题,九度OJ测试通过。
题目描述:
给定一个数字N,打印从1到最大的N位数。
输入:
每个输入文件仅包含一组测试样例。
对于每个测试案例,输入一个数字N(1<=N<=5)。
输出:
对应每个测试案例,依次打印从1到最大的N位数。...
分类:
其他好文 时间:
2014-05-13 16:06:33
阅读次数:
334
A - 无耻的出题人
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 KB
(Java/Others)
Submit Status
Problem Description
听到X神要参加比赛,只会Fibnacci数的出题人被吓得哭晕在厕所。为了防止X神AK(ALL KI...
分类:
其他好文 时间:
2014-05-13 16:01:26
阅读次数:
234
在Cracking the Code Interview上做过了一次,这次在九度OJ上测试,AC。
题目描述:
输入一个链表,输出该链表中倒数第k个结点。
(hint: 请务必使用链表。)
输入:
输入可能包含多个测试样例,输入以EOF结束。
对于每个测试案例,输入的第一行为两个整数n和k(0<=n<=1000, 0<=k<=1000):n代表将要输入的链表元素的个数,k代表要查询倒数第几个的元素。
输入的第二行包括n个数t(1<=t<=1000000):代表链表中的元素。
输出:...
分类:
其他好文 时间:
2014-05-13 13:49:14
阅读次数:
287
题目标题:
判断输入的字符串是不是一个有效的IP地址
详细描述:
请实现如下接口
boolisIPAddressValid(constchar* pszIPAddr)
输入:pszIPAddr 字符串
输出:true 有效的IP地址,false,无效的IP地址
约束
输入IP为XXX.XXX.XXX.XXX格式...
分类:
其他好文 时间:
2014-05-13 09:33:16
阅读次数:
313
1、
??
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 palindrom...
分类:
其他好文 时间:
2014-05-13 07:06:35
阅读次数:
284