【leetcode】Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution....
分类:
其他好文 时间:
2014-09-15 10:06:18
阅读次数:
192
二进制字符创相加,通过进位的方式逐位考虑。也可以把相加的过程抽象成一个函数。
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
方法一:
class Solution {
public:
s...
分类:
其他好文 时间:
2014-09-14 15:26:07
阅读次数:
285
// 算法:DFS// 递归函数参数使用引用//Time Limit Exceeded 1 class Solution { 2 public: 3 vector > findLadders( string start, string end, unordered_set &dict) { ...
分类:
其他好文 时间:
2014-09-14 11:18:47
阅读次数:
154
class Solution {#define SINGLE 1#define MULTIP 2public: bool isMatch(const char *s, const char *p) { if (s == NULL || p == NULL) return true...
分类:
其他好文 时间:
2014-09-14 01:20:56
阅读次数:
261
public class Solution { public boolean isPalindrome(int x) { if (x= 10 ) highNum *= 10; while (highNum > lowNum) { ...
分类:
其他好文 时间:
2014-09-13 20:01:25
阅读次数:
171
时间限制:2s空间限制:30M题意: 有K台挤奶机(编号1~K),C头奶牛(编号K+1~K+C),给出各点之间距离。现在要让C头奶牛到挤奶机去挤奶,每台挤奶机只能处理M头奶牛,求使所走路程最远的奶牛的路程最短的方案。Solution: 先Floyd求最短路,然后最大流二分答案ans。 ...
分类:
其他好文 时间:
2014-09-12 23:25:54
阅读次数:
221
应用升级大致步骤:检测是否有更新(读取服务器config文件,比对版本号)若发现高版本则读取更新文件updateinfo.xml获取下载更新相关信息校验信息确认升级后,下载apk下载完apk后,进行MD5检验apk的完整性安装apk升级入口 privatevoidupgrade(){
//需要访问网络,避免主线程..
分类:
移动开发 时间:
2014-09-12 02:31:23
阅读次数:
303
1 public class Solution { 2 public int minDepth(TreeNode root) { 3 if (root==null) return 0; 4 List upperLevelList = new ArrayLis...
分类:
其他好文 时间:
2014-09-12 01:08:32
阅读次数:
285
public class Solution { public int lengthOfLastWord(String s) { int lastLength = 0; int nowLength = 0; for (int i=0; i...
分类:
其他好文 时间:
2014-09-11 23:48:02
阅读次数:
230
public class Solution { public int sumNumbers(TreeNode root) { int sum=0; TreeNode nowNode = root; Stack nodeStack = new Stack...
分类:
其他好文 时间:
2014-09-11 23:40:42
阅读次数:
224