题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Exam ...
分类:
编程语言 时间:
2019-05-13 09:13:08
阅读次数:
106
Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra spa ...
分类:
其他好文 时间:
2019-05-12 12:23:03
阅读次数:
139
问题描述:https://leetcode-cn.com/problems/median-of-two-sorted-arrays/ 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。 你可以 ...
分类:
其他好文 时间:
2019-05-12 10:59:14
阅读次数:
135
Binary Search 时间复杂度 O(logN ), 因为每次减少一半 相当于取log Q: 什么时候可以用Binary Seach? A: 当数据是Sorted 并且支持Random Access的时候 Binary Search 的基本规则 1. 搜索空间在循环中不断减小 The Sear ...
分类:
其他好文 时间:
2019-05-12 01:17:00
阅读次数:
102
# ### 高阶函数 : 能够把函数当成参数传递的就是高阶函数 (map reduce sorted filter) # map(func,iterable) ''' 功能:把iterable里面的数据一个一个的拿出来,扔到func当中进行处理,然后把处理之后的结果放到迭代器当中,最终返回迭代器 参... ...
分类:
其他好文 时间:
2019-05-11 19:43:52
阅读次数:
193
Find First and Last Position of Element in Sorted Array 问题简介:给定按升序排序的整数数组,找到给定目标值的起始位置和结束位置. 注: 1.算法的运行时复杂度必须为O(log n) 2.如果在数组中找不到目标,则返回[-1,-1] 举例: 1: ...
分类:
编程语言 时间:
2019-05-09 13:54:52
阅读次数:
166
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given targetvalue. Given an array of integers nu ...
分类:
其他好文 时间:
2019-05-08 21:57:47
阅读次数:
112
题目链接: https://leetcode cn.com/problems/search in rotated sorted array/ 题目描述: 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 可能变为 )。 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的 ...
分类:
编程语言 时间:
2019-05-07 16:52:34
阅读次数:
126
LeetCode第21题 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two li ...
分类:
编程语言 时间:
2019-05-05 17:15:08
阅读次数:
112
import numpy as np from sklearn import datasets# 载入数据包 import numpy as np from sklearn import datasets# 载入数据包 import numpy as np from sklearn import d ...
分类:
编程语言 时间:
2019-05-05 11:57:29
阅读次数:
176