原题链接在这里:https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ 题目: You are given two integer arrays nums1 and nums2 sorted in ascending order ...
分类:
其他好文 时间:
2017-02-02 17:22:31
阅读次数:
171
思路一: 本题nums里面的数由于都是正数,所以可以用两个指针 start 和 end = 0。end++向后寻找,直到 start和end之间的sum>=s。例如 nums = [2, 3, 1, 2, 4, 3], s = 7。这一步结束时找到了start = 0 的最短的满足条件的subarr ...
分类:
其他好文 时间:
2017-02-02 15:33:23
阅读次数:
184
1. Two Sum Total Accepted: 409869 Total Submissions: 1347018 Difficulty: Easy Contributors: Admin Given an array of integers, return indices of the tw ...
分类:
其他好文 时间:
2017-02-02 10:56:59
阅读次数:
174
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... For example, given nums = [3, 5, 2, 1, 6, 4], ...
分类:
其他好文 时间:
2017-02-02 10:50:02
阅读次数:
180
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ...
分类:
其他好文 时间:
2017-02-02 10:47:18
阅读次数:
157
1 import numpy as np 2 # 基础属性 3 array = np.array([[[1,2,3], [0,0,1]], [[1,2,3], [0,0,1]]], 4 dtype = np.int64) 5 6 print(array) 7 print(array.ndim) # ... ...
分类:
编程语言 时间:
2017-02-02 01:02:12
阅读次数:
301
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or ...
分类:
其他好文 时间:
2017-02-01 21:37:57
阅读次数:
314
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 ... ...
分类:
编程语言 时间:
2017-02-01 20:45:24
阅读次数:
253
数据结构 向量: 向量是用于存储数值型、字符型或逻辑型数据的一维数组。 可通过函数c()可用来创建向量 实例操作: 矩阵: 矩阵是一个二位数组,只是每个元素都拥有相同的模式(数值型、字符型或逻辑型) 可通过函数matrix()创建矩阵 实例操作: 数组: 数组(array)与矩阵类似,但是维度可以大 ...
分类:
编程语言 时间:
2017-02-01 19:46:25
阅读次数:
209
题目 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, ...
分类:
移动开发 时间:
2017-02-01 16:29:38
阅读次数:
224