Just corner case..class Solution {public: ListNode *reverseBetween(ListNode *head, int m, int n) { if(m == n) return head; ListNode *...
分类:
其他好文 时间:
2014-07-31 09:34:05
阅读次数:
245
题目:Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must n....
分类:
编程语言 时间:
2014-07-31 05:22:45
阅读次数:
286
题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the tele....
分类:
编程语言 时间:
2014-07-31 05:22:05
阅读次数:
307
#!/bin/envpython
#-*-coding:utf-8-*-
fromConfigParserimportConfigParser
importjson
defgetConfigObject(filename):
"""获得配置文件对象
"""
_config_=ConfigParser()
_config_.read(filename)
return_config_
defgetConfigJson(filename,sections):
"""返回对应sections..
分类:
其他好文 时间:
2014-07-31 03:07:56
阅读次数:
267
问题描述:
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]
解题思路...
分类:
其他好文 时间:
2014-07-31 00:04:35
阅读次数:
204
问题描述:
Implement atoi to convert a string to an integer.
解题思路:
对于一个字符串需要注意一下几点:
1、过滤字符串开头的所有空格字符;
2、注意数字字符前面的“+”和“-”字符,从而确定数字的正负号;
3、只处理数字字符,一旦出现非数字字符,立即停止字符串处理,并返回已处理的结果;
4、返回结果时要注意数字越界的问题,不能...
分类:
其他好文 时间:
2014-07-31 00:03:45
阅读次数:
314
问题描述:
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
解题思路:
这是一个典型的斐波那契数列,对于...
分类:
其他好文 时间:
2014-07-31 00:02:55
阅读次数:
243
Bellman-ford算法的反向应用--正循环检查
/** \brief poj 1860 Bellman-Ford
*
* \param date 2014/7/24
* \param state AC
* \return memory 708K time 141ms
*
*/
#include
#include
#include
using namespace std...
分类:
其他好文 时间:
2014-07-31 00:01:23
阅读次数:
213
double getUnixTime(void){ struct timespec tv; if(clock_gettime(CLOCK_REALTIME, &tv) != 0) return 0; return (((double) tv.tv_sec) + (double) (...
分类:
系统相关 时间:
2014-07-30 23:25:05
阅读次数:
228
水题:
代码如下:
#include
#include
int main()
{
int n,m,i,j,count;
double c,sc;//设为double型才给通过
double s,s1,s2;
char name[33];
scanf("%d",&n);
while(n--)
{
s1=s2=0;
count=0;
scanf(...
分类:
其他好文 时间:
2014-07-30 20:58:04
阅读次数:
148