Time complexity: O(m + n) Space complexity: O(1) 值得提高的地方: 1. LinkedList 可以通过增加index为-1的node来使代码更精简,看起来更好看。 2. 不要掉入一个,把list 2融合进list 1里的怪圈。因为这个LinkedLi ...
分类:
其他好文 时间:
2018-11-13 20:28:23
阅读次数:
136
概念 列表是一个线性的集合,允许用户在任意位置插入、删除、访问和替换元素 使用列表 基于索引的操作 基本操作 数组与列表的区别 数组是一种具体的数据结构,拥有基于单个的物理内存块的一种特定的,不变的实现。 列表是一种抽象的数据类型,可以由各种方式表示,数组只是其中一种方式 基于内容的操作 基本操作 ... ...
分类:
编程语言 时间:
2018-11-10 21:09:47
阅读次数:
250
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, ...
分类:
其他好文 时间:
2018-11-10 10:53:38
阅读次数:
151
1 #include 2 int main(void) 3 { 4 int i, j, t, a[11]; 5 6 printf("please input 10 numbers:\n"); 7 8 for(i = 1;i a[j+1]) 14 { 15 t = a[j]; 16 ... ...
分类:
编程语言 时间:
2018-11-10 10:46:26
阅读次数:
147
Given an integer array sorted in ascending order, write a function to search target in nums. If target exists, then return its index, otherwise return ...
分类:
编程语言 时间:
2018-11-10 00:59:10
阅读次数:
234
将68个内置函数按照其功能分为了10类,分别是: 数学运算(7个) abs() divmod() max() min() pow() round() sum() 类型转换(24个) bool() int() float() complex() str() bytearray() bytes() me ...
分类:
编程语言 时间:
2018-11-09 22:57:39
阅读次数:
288
http://www.nnzhp.cn/archives/152 1、max,min,round 2、sorted 3、ord、chr 4、any、all 5、dir获取帮助信息 6、eval 执行python代码,只能执行简单的,定义数据类型和运算 实例1: 执行结果: 实例2: 执行结果: 7、 ...
分类:
其他好文 时间:
2018-11-09 22:05:12
阅读次数:
202
A sorted list A contains 1, plus some number of primes. Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fra ...
分类:
其他好文 时间:
2018-11-09 20:52:52
阅读次数:
296
数学相关 abs(a) : 求取绝对值。abs(-1) max(list) : 求取list最大值。max([1,2,3]) min(list) : 求取list最小值。min([1,2,3]) sum(list) : 求取list元素的和。 sum([1,2,3]) >>> 6 sorted(li ...
分类:
编程语言 时间:
2018-11-09 17:09:50
阅读次数:
160
Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the ...
分类:
其他好文 时间:
2018-11-08 18:22:24
阅读次数:
122