题目:Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After rem...
分类:
其他好文 时间:
2014-07-07 19:01:42
阅读次数:
155
总结:我觉得这道题目还是很不错的。唯一不足的地方是题目没有描述清楚:名字的漂亮度=26*字母个数最多的+25*字母个数其次的+24*字母个数再其次的……其中要计算每个字母出现的频次,这里用到的算法int b[26]={0};b[[a[i][j]-'a']++;是我以前从别人的算法中学过来的。还要对频次进行排序,而且名字的漂亮度有两个量:字母的频次*字母的漂亮度。虽然是道初级题,个人认为还是可以考查基本功~哈哈,每天都登陆华为OJ平台,希望可以进华为哈~...
分类:
其他好文 时间:
2014-06-28 07:06:43
阅读次数:
266
题目:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should ...
分类:
其他好文 时间:
2014-06-27 11:55:43
阅读次数:
187
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing...
分类:
其他好文 时间:
2014-06-27 11:38:12
阅读次数:
207
http://acm.hdu.edu.cn/showproblem.php?pid=1372以前真二,模板题OJ真奇怪,有时能A有时W,#include #include #include #include using namespace std;struct node{ int x,y,z;...
分类:
其他好文 时间:
2014-06-26 12:17:50
阅读次数:
161
【题目】
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as a separator for each node, and , as a separator for node label and each ne...
分类:
其他好文 时间:
2014-06-26 06:48:16
阅读次数:
285
杭电OJ(HDU)-ACMSteps-Chapter Three-《FatMouse' Trade》《今年暑假不AC》《排名》《开门人和关门人》...
分类:
其他好文 时间:
2014-06-25 19:50:46
阅读次数:
227
今天在华为OJ上遇到这么一个题目,很简单,但是却总是得不到最好的成绩记录。因此比较了自己的程序、思路与别人的异同,发现还是有很大区别的,遂记录如下。
题目——
输入一个int型整数,求该整数的二进制在内存中有多少个1。例如输入10,由于其二进制表示为1010,有两个1,因此输出2。
思路1
public static void main(String[] args) {
...
分类:
其他好文 时间:
2014-06-25 07:56:23
阅读次数:
210
/*扑克牌游戏大家应该都比较熟悉了,一副牌由54张组成,含3~A、2各4张,小王1张,大王1张。牌面从小到大用如下字符和字符串表示(其中,小写joker表示小王,大写JOKER表示大王):
3 4 5 6 7 8 9 10 J Q K A 2 joker JOKER
输入两手牌,两手牌之间用"-"连接,每手牌的每张牌以空格分隔,"-"两边没有空格,如:4 4 4 4-joker JOKER。...
分类:
编程语言 时间:
2014-06-24 23:25:30
阅读次数:
517