This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be ...
分类:
其他好文 时间:
2019-02-09 21:02:06
阅读次数:
124
Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individuall ...
分类:
其他好文 时间:
2019-02-09 20:59:16
阅读次数:
129
https://leetcode.com/problems/insertion-sort-list/ Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted ...
分类:
其他好文 时间:
2019-02-09 18:01:45
阅读次数:
204
[toc] 题目链接 "Merge k Sorted Lists LeetCode" 注意点 给出了链表是有序的 解法 解法一:暴力。用map收集所有链表的数据,然后排序生成新链表。时间复杂度O(kn) 解法二:分治法。比如6个链表,先合并14、25、36。然后合并13,最后和2合并即可。要用到 " ...
分类:
其他好文 时间:
2019-02-08 14:35:41
阅读次数:
188
3 《数据串:字典{}、列表[]》 (1)添加or修改 -- [list元素] \ [dict: 值] (2)相互嵌套 (3){字典}转换成【list嵌套元组tuple】 (4)【合并字典】【合并列表】 (5)【直接遍历-字典dict中的值】 (6)【取出list里面全部int / str】 (7) ...
分类:
其他好文 时间:
2019-02-07 12:08:34
阅读次数:
159
算法描述: 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, ...
分类:
其他好文 时间:
2019-02-07 10:52:51
阅读次数:
152
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num ...
分类:
其他好文 时间:
2019-02-07 09:35:27
阅读次数:
142
算法描述: Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the firs ...
分类:
其他好文 时间:
2019-02-06 21:16:22
阅读次数:
174
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh ...
分类:
其他好文 时间:
2019-02-06 13:16:54
阅读次数:
171
https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ You are given two integer arrays nums1 and nums2 sorted in ascending order and an integ ...
分类:
其他好文 时间:
2019-02-06 11:52:53
阅读次数:
118