https://leetcode.com/submissions/detail/28015840/Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe ...
分类:
编程语言 时间:
2015-05-19 14:27:27
阅读次数:
149
给你2个链表,需要找到这2个链表的重合点的起点,从起点之后所有的点都一样了。这里题目要求时间复杂度o(n),空间复杂度o(1),就说明不需要额外的空间,只需要遍历就能做出来,关键是思路的问题。然后就以这个o(n)和o(1)为前提进行思考,首先想到的就是长度,重叠之后的元素都一样了,遍历到最后一个肯定...
分类:
其他好文 时间:
2015-05-19 12:47:25
阅读次数:
147
Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially...
分类:
其他好文 时间:
2015-05-19 12:30:28
阅读次数:
129
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a l...
分类:
其他好文 时间:
2015-05-18 21:18:42
阅读次数:
106
题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码:/** * Definition for singly-linked list. * struc...
分类:
其他好文 时间:
2015-05-18 20:46:25
阅读次数:
105
题目描述You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers...
分类:
其他好文 时间:
2015-05-18 18:57:11
阅读次数:
119
主要区别是两个或者多个数组中如果出现相同键名,键名分为字符串或者数字,需要注意1)键名为数字时,array_merge()不会覆盖掉原来的值,但+合并数组则会把最先出现的值作为最结果返回,而把后面的数组拥有相同键名的那些值“抛弃”掉(不是覆盖) 2)键名为字符时,+仍然把最先出现的值作为最终结果返回...
分类:
其他好文 时间:
2015-05-18 18:12:10
阅读次数:
100
ists:append([[1,2,3],[1,b],[3,4,5]]). 结果为?[1,2,3,a,b,3,4,5] 把多个列表合并成一个列表 lists:append("abc","sad"). 结果为?"abcsad" 合并 lists:concat([doc,‘/‘,file,‘.‘,3]). 结果为?"doc/file.3" li...
分类:
其他好文 时间:
2015-05-18 16:58:29
阅读次数:
145
public class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { int i = m - 1; int j = n - 1; int k = m + ...
分类:
其他好文 时间:
2015-05-18 16:14:56
阅读次数:
100
题目:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is gr...
分类:
其他好文 时间:
2015-05-18 16:12:27
阅读次数:
87