class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int total = nums1.size() + nums2.size(); if (total % ...
分类:
其他好文 时间:
2017-01-29 20:41:33
阅读次数:
234
class Solution { public: string convert(string s, int nRows) { if (nRows <= 1) return s; string res = ""; int size = 2 * nRows - 2; for (int i = 0; i ...
分类:
其他好文 时间:
2017-01-29 20:40:13
阅读次数:
191
为了解决Java基本数据类型在运算时会出现的溢出和计算不精确的问题。Java 提供了两个类BigInteger和BigDecimal,专门用于进行高精度运算。凡是能用int 或float 做的事情,用BigInteger和BigDecimal也可以做,只是必须换用方法调用,而不是使用运算符。高精度整 ...
分类:
编程语言 时间:
2017-01-29 16:59:01
阅读次数:
296
Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area o ...
分类:
编程语言 时间:
2017-01-29 15:26:52
阅读次数:
185
入职前就给安排了MOOC视频,其中看到了关于指针的几段。 main执行后,bb的tmp值是随机的,而i的tmp值是100. 原因,bb作为指针传入,在函数fun内将tt的地址传给b,函数返回后,参数出栈,指针指向无变化。但是return相当于内存复制,把栈中tt的地址复制给了i。 所以i的其实就是栈 ...
分类:
其他好文 时间:
2017-01-29 14:40:03
阅读次数:
148
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except ...
分类:
其他好文 时间:
2017-01-29 10:45:29
阅读次数:
228
#include<stdio.h>#define N 10000int main(){ int i,j,a[N]; for(i=2;i<N;i++) a[i]=1; for(i=2;i<N;i++) if(a[i]) for(j=i;i*j<N;j++) a[i*j]=0; for(i=2;i<N; ...
分类:
其他好文 时间:
2017-01-28 22:11:12
阅读次数:
171
转载请注明出处:http://www.cnblogs.com/liangyongrui/p/6354552.html 异或的妙用。 一开始读题不仔细,以为有很多的孤立数字。 没想到就两个- - 然后参考了别人的思路。 具体见代码: ...
分类:
其他好文 时间:
2017-01-28 22:07:19
阅读次数:
226