Merge Sorted ArrayGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that i...
分类:
其他好文 时间:
2014-07-25 02:34:44
阅读次数:
162
题意:n个珠子,给定它们之间的重量关系,按重量排序,求确定肯定不排在中间的珠子的个数
分析:因为n为奇数,中间为(n+1)/2,对于某个珠子,若有至少有(n+1)/2个珠子比它重或轻,则它肯定不排在中间
可以将能不能确定的权值初始化为0,能确定重量关系的权值设为1...
分类:
其他好文 时间:
2014-07-24 23:35:13
阅读次数:
210
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".算法思路:模拟二进制加法,跟十进制木有区别,将a,b转置(不转置的话,倒着...
分类:
其他好文 时间:
2014-07-24 22:57:23
阅读次数:
216
To import the library to Android Studio, there is two methods that can (or cannot) work. The first one worked for me, but when I tried the second, it ...
分类:
移动开发 时间:
2014-07-24 22:42:13
阅读次数:
284
Two Sum Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of t...
分类:
其他好文 时间:
2014-07-24 22:32:52
阅读次数:
194
Divide two integers without using multiplication, division and mod operator.题解:要求不用乘除和取模运算实现两个数的除法。那么用加减法是很自然的选择。不过如果一次只从被除数中剪掉一个除数会TLE。所以我们借助移位运算,依次从...
分类:
其他好文 时间:
2014-07-24 17:09:15
阅读次数:
203
一. redis
Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes
http...
分类:
其他好文 时间:
2014-07-24 10:32:58
阅读次数:
223
本文翻译自JavaScript’s two zerosJavaScript has two zeros: ?0 and +0. This post explains why that is and where it matters in practice.JavaScript 中有两个“0”: -0...
分类:
编程语言 时间:
2014-07-24 10:18:03
阅读次数:
454
总时间限制:1000ms内存限制:65536kB描述Calculate a + b输入Two integer a,,b (0 ≤ a,b ≤ 10)输出Output a + b样例输入1 2样例输出3提示Q: Where are the input and the output?A: Your pr...
分类:
其他好文 时间:
2014-07-24 10:07:23
阅读次数:
287
Snowflake Snow SnowflakesTime Limit: 4000MSMemory Limit: 65536KTotal Submissions: 30652Accepted: 8076DescriptionYou may have heard that no two snowfla...
分类:
其他好文 时间:
2014-07-24 10:04:03
阅读次数:
283