Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function ...
分类:
其他好文 时间:
2018-12-03 00:51:39
阅读次数:
197
sorted函数可以直接用来对list进行升序排序,如果是数字则按由小到大排序,若是字符则按大写小于小写来排序。 除此之外,sorted还可以按指定的key方法进行排序,因此该函数亦是高阶函数。 比如令L=[1,-3,21,6,-43],则sorted(L,key=abs)=[1,-3,6,21,- ...
分类:
编程语言 时间:
2018-12-02 22:32:50
阅读次数:
207
https://leetcode.com/problems/summary-ranges/ Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Example 2: ...
分类:
其他好文 时间:
2018-12-02 19:16:40
阅读次数:
209
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function ...
分类:
其他好文 时间:
2018-12-02 12:24:41
阅读次数:
164
public class RemoveDuplicates { /** * 修改数组,使数组有序不重复。超出长度不考虑。 * @param 排序数组 * @return 数组不重复数的个数 */ public int removeDuplicates(int[] nums) { // 需要修改的元素... ...
分类:
编程语言 时间:
2018-12-01 23:42:20
阅读次数:
224
树结构问题因为容易写出解法,因此经常出现在面试题中 1. 树的种类 1) Tree 2) Binary Trees 3) Binary Search Trees(BST) : used to sorted or ordered data. //解决方案:recursion 查找操作(fast and ...
分类:
其他好文 时间:
2018-12-01 18:40:43
阅读次数:
191
For a given sequence $A = \{a_0, a_1, ..., a_{n-1}\}$ which is sorted by ascending order, find a specific value $k$ given as a query. Input The input ...
分类:
其他好文 时间:
2018-12-01 15:33:09
阅读次数:
211
数据类型 1.string(字符串) 2.hash(哈希,类似java里的Map) 3.list(列表) 4.set(集合) 5.zset(sorted set:有序集合) 6.基数 String(字符串) string是redis最基本的类型,你可以理解成与Memcached一模一样的类型,一个k ...
分类:
其他好文 时间:
2018-12-01 00:46:54
阅读次数:
225
21、 Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th ...
Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。 redis是一个key-value存储系统,支持存储的value类型包括string(字符串)、list(链表)、set(集合)、zset(sorted set... ...
分类:
编程语言 时间:
2018-11-29 15:38:26
阅读次数:
187