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.对于这个删除链表中的重复元素但是对于重复元素需要保留一个,前面遇到的...
分类:
其他好文 时间:
2015-06-08 19:41:37
阅读次数:
172
Java中的泛型的使用:1.普通的泛型使用
在使用类的时候后面的
public class MyClass1 {//此处定义的泛型是T
private T var;
public T getVar() {
return var;
}
public void setVar(T var) {
this.var =...
分类:
编程语言 时间:
2015-06-08 19:41:12
阅读次数:
125
safe保险一点5吧。我是MR: 1 const int Safe=3; 2 int gcd(int a,int b){return !b?a:gcd(b,a%b);} 3 int mul(int a,int b,int p){ 4 int tmp=(a*b-(int)((double)a/...
分类:
其他好文 时间:
2015-06-08 19:26:08
阅读次数:
135
题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-n...
分类:
其他好文 时间:
2015-06-08 19:23:30
阅读次数:
140
1、错误写法: function () { //单独的匿名函数是无法运行的,会报错 。就算能运行,也无法调用,因为没有名称 return 'Lee'; }2、把匿名函数赋值给变量 var box = function () { //将匿...
分类:
编程语言 时间:
2015-06-08 19:17:53
阅读次数:
164
#include#include#define LL __int64LL mult_mod(LL a,LL b,LL c){ a%=c; b%=c; LL ret=0; while(b) { if(b&1){ret+=a;ret%=c;} a=c)a%=c; b>>=1; } return ret;...
分类:
其他好文 时间:
2015-06-08 18:51:16
阅读次数:
150
1. 题目 Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices ...
分类:
其他好文 时间:
2015-06-08 18:45:08
阅读次数:
172
L58: Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘,
return the length of last word in the string.
If the last word does not exist, retur...
分类:
其他好文 时间:
2015-06-08 17:27:49
阅读次数:
145
Given a collection of numbers, return all possible permutations.
For example,
[1,2,3] have
the following permutations:
[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],
and [3,2,1].
解题思路:求一串数字的...
分类:
其他好文 时间:
2015-06-08 17:26:10
阅读次数:
110
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only
distinct numbers from the original list.For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2-...
分类:
其他好文 时间:
2015-06-08 17:16:19
阅读次数:
106