问题描述:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
代码:
import java.util.List;
public class Merge...
分类:
其他好文 时间:
2014-10-28 20:03:24
阅读次数:
203
问题描述:
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 order.
You may assume no duplicates in...
分类:
其他好文 时间:
2014-10-28 12:19:51
阅读次数:
191
问题描述:
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
思路:遍历链表,通过两个指针...
分类:
其他好文 时间:
2014-10-28 12:12:23
阅读次数:
143
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
题目描述:
类似以前C语言做的输入两个链表,按照顺序大小将其连接。
不过这次试着用JAVA做,...
分类:
其他好文 时间:
2014-10-27 17:38:37
阅读次数:
147
class Program { static void Main(string[] args) { SorAndShowFiles("Sorted by name", delegate(FileInfo f1, FileInfo f2) { ...
(1)浅拷贝:当 a = b时,实际上对a只是复制了一个b的引用,如果a的值改变了,b的值也会改变,这就是浅拷贝。同样,对list切片也会引起浅拷贝(2)排序:python内置了两种排序方法,sort和sorted。a.sort() 或者 b = a.sort() 改变了a中的顺序b =sorted...
分类:
编程语言 时间:
2014-10-27 10:28:38
阅读次数:
185
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution:/** * Definition for binary tree * public cl...
分类:
其他好文 时间:
2014-10-27 06:51:31
阅读次数:
137
级别简单,用了额外的空间,不知道这个可不可以改进,最后到时ac了。public class Solution { public void merge(int A[], int m, int B[], int n) { int res[] = new int[m + n]; ...
分类:
其他好文 时间:
2014-10-26 22:48:56
阅读次数:
234
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...
分类:
其他好文 时间:
2014-10-26 22:28:57
阅读次数:
172
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were initially sorted according to their start times.
E...
分类:
其他好文 时间:
2014-10-26 15:38:41
阅读次数:
196