码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
Find First and Last Position of Element in Sorted Array
问题:给定一个有序数组和一个目标值,输出目标值在数组中的起始位置和终止位置,如果目标值不在数组中,则输出[-1,-1] 示例: 输入:nums = [1,2,3,5,5,7] target = 5 输出:[3,4] 输入:nums = [1,5,8,9] target = 7 输出:[-1,-1] ...
分类:其他好文   时间:2019-04-18 12:22:41    阅读次数:129
[LeetCode] 33. Search in Rotated Sorted Array_Medium tag: Binary Search
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Y ...
分类:其他好文   时间:2019-04-16 10:38:18    阅读次数:175
notes for lxf(三)
纯函数式编程是没有变量的,只要输入确定输出就确定 指高度抽象的编程范式 特点 函数本身可以作为参数传入 或者允许返回一个函数 Higher-order function 一个函数可以接收另一个函数作为参数 函数名其实就是指向函数的变量 map(func_name, Iterable) 序列的每一个元 ...
分类:其他好文   时间:2019-04-15 22:59:25    阅读次数:150
第一周练习
"167. Two Sum II Input array is sorted" 分析:简单题,双指针,如果比target大,则说明j要变小,如果比target小,说明i要变大 "215. Kth Largest Element in an Array" 分析:快排思想,不过递归的时候根据当前位置和k ...
分类:其他好文   时间:2019-04-15 21:38:56    阅读次数:176
#Leetcode# 81. Search in Rotated Sorted Array II
https://leetcode.com/problems/search-in-rotated-sorted-array-ii/ Suppose an array sorted in ascending order is rotated at some pivot unknown to you be ...
分类:其他好文   时间:2019-04-15 09:14:17    阅读次数:143
[LeetCode] 4. 寻找两个有序数组的中位数
题目链接:https://leetcode cn.com/problems/median of two sorted arrays/ 题目描述: 给定两个大小为 m 和 n 的有序数组 和 。 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。 你可以假设 和 ...
分类:编程语言   时间:2019-04-13 17:38:10    阅读次数:148
Lintcode177-Convert Sorted Array to Binary Search Tree With Minimal Height-Easy
177. Convert Sorted Array to Binary Search Tree With Minimal Height Given a sorted (increasing order) array, Convert it to create a binary tree with m ...
分类:其他好文   时间:2019-04-10 13:35:57    阅读次数:112
88.Merge Sorted Array
``` class Solution { public: void merge(vector& nums1, int m, vector& nums2, int n) { int i = m - 1, j = n - 1, k = m + n - 1; while (i >= 0 && j >= 0... ...
分类:其他好文   时间:2019-04-09 12:46:00    阅读次数:136
81.Search in Rotated Sorted Array II
``` class Solution { public: bool search(int A[], int n, int target) { if (n == 0) return false; int left = 0, right = n - 1; while (left = target) le... ...
分类:其他好文   时间:2019-04-09 12:42:40    阅读次数:113
83.Remove Duplicates from Sorted List
``` /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class ... ...
分类:其他好文   时间:2019-04-09 12:32:43    阅读次数:152
5925条   上一页 1 ... 71 72 73 74 75 ... 593 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!