Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you ...
分类:
其他好文 时间:
2017-01-28 10:07:08
阅读次数:
198
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo ...
分类:
其他好文 时间:
2017-01-28 10:05:54
阅读次数:
190
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make pro ...
分类:
其他好文 时间:
2017-01-28 07:21:03
阅读次数:
306
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. ...
分类:
其他好文 时间:
2017-01-28 07:17:10
阅读次数:
182
从composer安装sami $ composer require sami/sami composer自动配置完以后,可以先测试一下是否安装成功。只要不带参数的运行一下sami,就会知道结果。 $ php vendor/sami/sami/sami.php 如果不出意外,安装是成功的。那么要使用 ...
分类:
其他好文 时间:
2017-01-28 07:17:02
阅读次数:
252
如果一个函数直接或者间接调用了自己,那么就形成了递归(recursion),比如斐波那契数列的一个实现 def fib(n): if n <= 2: return 1 else: return fib(n - 1) + fib(n - 2) 递归一定要有结束条件,否则就形成了死循环, 比如下面的例子 ...
分类:
编程语言 时间:
2017-01-27 15:03:37
阅读次数:
317
作为一名优秀的程序员,必须保证自己的代码能提供正确的,完善的接口,如此方能和同事,甲方更好的沟通合作,也让自己的代码更加地容易维护。 本文将介绍一些设计优秀接口的思路。 ...
分类:
其他好文 时间:
2017-01-27 12:53:07
阅读次数:
288
看一下AbstractQueuedSynchronizer(以下简称AQS)的子类就可以知道,J.U.C中宣传的封装良好的同步工具类Semaphore、CountDownLatch、Reentrant...
分类:
其他好文 时间:
2017-01-27 11:04:23
阅读次数:
178
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex ...
分类:
其他好文 时间:
2017-01-27 08:44:26
阅读次数:
153
Implement int sqrt(int x). Compute and return the square root of x. 小小的一道题竟然做了半天。。。= = 乘法啊加法啊reverse这些一定要考虑到越界的问题。 另外可以使用start + 1 < end的条件,这个时候一般跳出循环 ...
分类:
其他好文 时间:
2017-01-27 07:20:37
阅读次数:
150