Soldier and Cards
Description
Two bored soldiers are playing card war. Their card deck consists of exactly
n cards, numbered from 1 to
n, all values are different. They divide cards between th...
分类:
其他好文 时间:
2015-07-20 16:41:19
阅读次数:
116
题目链接:https://leetcode.com/problems/divide-two-integers/
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
int divide(in...
分类:
其他好文 时间:
2015-07-20 09:19:59
阅读次数:
99
https://leetcode.com/problems/divide-two-integers/需要注意的,int类型的数据,正数最大和负数最小可以表示到:2147483647-2147483648正数最大的二进制码为:011111111......1111,负数最小的二进制码为:1000000...
分类:
其他好文 时间:
2015-07-18 18:31:53
阅读次数:
141
There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should...
分类:
其他好文 时间:
2015-07-12 17:22:50
阅读次数:
108
题目:
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
题意:
不使用乘法,除法和取余操作,令两个整数相除.
如果溢出,就返回 MAX_INT.
算法分析:
参考博客http://blog.csdn...
分类:
编程语言 时间:
2015-07-11 13:44:27
阅读次数:
163
BigDecimal类
java.math.BigDecimal
用来处理高精度计算。可存浮点数。对应的整型类为BigInteger
几个比较重要的函数:
BigDecimal add(BigDecimal augend) :加法
BigDecimal subtract(BigDecimal subtrahend) :减法
BigDecimal divide(BigDe...
分类:
其他好文 时间:
2015-07-10 15:23:13
阅读次数:
221
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 the two nu...
分类:
其他好文 时间:
2015-07-10 00:14:30
阅读次数:
116
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INTpublic class Solution { //本题很多细节需要考虑: ...
分类:
其他好文 时间:
2015-07-09 00:11:06
阅读次数:
124
转自:http://blog.csdn.net/morewindows/article/details/6684558快速排序是C.R.A.Hoare于1962年提出的一种划分交换排序。它采用了一种分治的策略,通常称其为分治法(Divide-and-ConquerMethod)。该方法的基本思想是:...
分类:
编程语言 时间:
2015-07-08 22:08:56
阅读次数:
141
Divide Two Integers
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
思路:这个题算法上不是很难,但是通过率相当低,只有15%,果然,自己在写完之后,各种出错,而且错误不是算法上...
分类:
其他好文 时间:
2015-07-08 09:38:07
阅读次数:
115