Time Limit:1000MS Memory Limit:32768KDescription:不可否认,fans是一名数学天才,大家都这么说。天才fans的两大最新发现如下:(1) 正整数n除3的余数,等价于正整数n的各位数字之和除3的余数;(2) 正整数n除9的余数可以通过这样的方法来计算:计...
分类:
其他好文 时间:
2014-12-25 23:27:01
阅读次数:
216
这次学校数据结构机考,题目很奇怪,简直让我觉得这是算法考试……三道题,撑死了用到树的遍历和并查集,连个队列都没用,也是醉了-.-第一题 高精度加法 两个数相加,数最多5000位,也就是和最多5001位,而且连数的长度都会给。直接两个数组相加就好。第二题 给出树的前序、中序遍历,要求写出树的后...
分类:
其他好文 时间:
2014-12-25 16:13:16
阅读次数:
138
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.SOLUTION 1:...
分类:
其他好文 时间:
2014-12-23 13:52:56
阅读次数:
200
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【解析】
题意:两个字符串表示的非负整数相乘,用字符串的...
分类:
其他好文 时间:
2014-12-23 12:32:31
阅读次数:
174
题目链接:http://codeforces.com/problemset/problem/496/B题目意思:给出 n 位数你,有两种操作:1、将每一位数字加一(当某一位 > 9 时只保存个位数) 2、循环右移(最右边那个数字去到第一位上)。问经过若个两种操作的组合后,得到的最小数值为多少。 .....
分类:
其他好文 时间:
2014-12-23 00:15:39
阅读次数:
261
做幻方 Time Limit:1000MS Memory Limit:1024KDescription:Apple最近迷上了做幻方,Apple还是个中高手,只要你说个奇数N,他就能把N*N的幻方做出来。其实你可以比他做得更好的。Apple总是画得很乱,而你可以利用程序排得很整齐^_^ 幻方的要求:每...
分类:
其他好文 时间:
2014-12-23 00:14:11
阅读次数:
346
Gas StationThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank a...
分类:
其他好文 时间:
2014-12-23 00:01:26
阅读次数:
377
Minimum Path SumGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers ...
分类:
其他好文 时间:
2014-12-22 21:11:52
阅读次数:
229
Binary Tree Level Order TraversalGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level)....
分类:
其他好文 时间:
2014-12-22 21:05:37
阅读次数:
102
Sort Colors II 原题链接: http://lintcode.com/zh-cn/problem/sort-colors-ii/#Given an array ofnobjects with k different colors (numbered from 1 to k), sort ...
分类:
其他好文 时间:
2014-12-22 00:47:02
阅读次数:
263