原题地址:https://oj.leetcode.com/problems/min-stack/解题思路:开辟两个栈,一个栈是普通的栈,一个栈用来维护最小值的队列。代码:class MinStack: # @param x, an integer def __init__(self): ...
分类:
编程语言 时间:
2014-11-12 13:44:19
阅读次数:
213
Prince and PrincessTime Limit: 3000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:468564-bit integer IO format:%I64d Java class...
分类:
其他好文 时间:
2014-11-12 00:15:14
阅读次数:
276
Description
The SUM problem can be formulated as follows: given four lists
A, B, C, D of integer values, compute how many quadruplet
(a, b, c, d ) AxBxCxD
are such that a + b + c + d = 0 . In...
分类:
其他好文 时间:
2014-11-11 22:55:20
阅读次数:
173
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
class Solution {
public:
int reverse(int x) {
int Answer=0;
...
分类:
其他好文 时间:
2014-11-11 22:53:55
阅读次数:
203
1.前导程序/对用户输入的整数求和#includeint main(void){ long num; long sum=0L;//把sum初始化为0 int status; printf("please enter an integer to be summed."); ...
分类:
其他好文 时间:
2014-11-11 18:55:25
阅读次数:
155
Crossed MatchingsTime Limit: 2 Seconds Memory Limit: 65536 KBThere are two rows of positive integer numbers. We can draw one line segment between any....
分类:
其他好文 时间:
2014-11-11 18:49:49
阅读次数:
199
java.lang.Integer.parseInt(String)public static int parseInt(Strings) throws NumberFormatExceptionParses the string argument as a s...
分类:
其他好文 时间:
2014-11-11 18:09:38
阅读次数:
282
1.返回List,.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);将结果转为Map,存放到list中,即list中为若干map对象;获取可按此方法:for(inti=0;ipublicListgetDamTestType(Integer...
分类:
数据库 时间:
2014-11-11 12:21:19
阅读次数:
264
Problem DescriptionYou just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.InputIn each case, there is an odd positive integer n.Outpu...
分类:
其他好文 时间:
2014-11-10 23:09:21
阅读次数:
271
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
E...
分类:
其他好文 时间:
2014-11-10 20:00:33
阅读次数:
193