Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it. https://www.geeksfor ...
分类:
其他好文 时间:
2018-10-05 12:10:00
阅读次数:
126
题目如下: 解题思路:简单的不能再简单的题目了,对于任意一个A[i]来说,其可能的最小的最大值是A[i]-K,最大的最小值是A[i]+K。遍历数组,求出所有元素中最大的最小值和最小的最大值,两者之差(小于零则取零)就是答案。 代码如下: ...
分类:
其他好文 时间:
2018-09-25 14:03:29
阅读次数:
109
1 class Solution 2 { 3 public: 4 int smallestRangeI(vector& A, int K) 5 { 6 int Max = INT_MIN; 7 int Min = INT_MAX; 8 for(auto d:A) 9 ... ...
分类:
其他好文 时间:
2018-09-23 13:49:26
阅读次数:
283
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we c ...
分类:
其他好文 时间:
2018-09-23 13:48:06
阅读次数:
191
Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Examp ...
分类:
其他好文 时间:
2018-09-16 12:23:58
阅读次数:
137
Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains ...
分类:
其他好文 时间:
2018-09-15 22:07:00
阅读次数:
220
https://leetcode.com/problems/smallest-range/description/ 给你k个数组,找一个最小区间[a,b],可以包含k个数组中的数字各至少一个。 滑动窗口题。 对于要求“最短”的题目很适用。 points: 1.在扩张右界的时候,一旦碰到合法就停止,但 ...
分类:
其他好文 时间:
2018-09-13 14:25:14
阅读次数:
155
def findsmallest(arr): smallest=arr[0] smallest_index=0 for i in range(1,len(arr)): #smallest_index+=1 if arr[i]<=smallest: smallest=arr[i] smallest_i ...
分类:
编程语言 时间:
2018-09-09 20:32:16
阅读次数:
208