【题目】
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
【题意】
给定一个有序数组,给数组去重,和Remove Duplicates from...
分类:
其他好文 时间:
2014-06-03 05:36:24
阅读次数:
219
apache的虚拟主机一直运行都是正常,但是当我升级了ubuntu系统之后,再启动apache时,虚拟主机出现了forbidden的错误。在网上找了很长时间答案,但是很多方法试了之后都无效,最后还是找到了解决办法,先记录下来,后面防止再发生这样的错误。
奇怪现象:如果将document root指向/var/www或其子目录,那么就不会出现forbidden错误————太奇怪了~~
失败方法:...
分类:
其他好文 时间:
2014-06-03 04:13:25
阅读次数:
202
【题目】
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.
【题意】
给定一个已排序的链表,删除其中的重复元素
【思路】
维护两个指针prev和cur, cur指针负责扫描链表,prev指向cur的前一...
分类:
其他好文 时间:
2014-06-03 04:05:39
阅读次数:
231
【题目】
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the array.
【题意】
在“Search in Rotated Sorted Array”的基...
分类:
其他好文 时间:
2014-06-03 01:55:38
阅读次数:
173
交换两个变量:例如num1=5,num2=6→num1=6,num=5
怎么样?是不是觉得灰常简单,你是不是用下面的方法做的:
int num1=5;
int num2=6;
int temp=num1;
num1=num2;
num2=temp;
Console.WriteLine("num1={0},num2={1}",num1,num2);
好吧!你赢了!你做的非常对!就就是...
分类:
其他好文 时间:
2014-06-03 01:51:43
阅读次数:
225
【题目】
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be use...
分类:
其他好文 时间:
2014-06-03 01:07:58
阅读次数:
329
在面向对象系统的设计和开发过程中,对象之间的交互和通信是最为常见的情况,因为对象间的交互本身就是一种通信。在系统比较小的时候,可能对象间的通信不是很多、对象也比较少,我们可以直接硬编码到各个对象的方法中。但是当系统规模变大,对象的量变引起系统复杂度的急剧增加,对象间的通信也变得越来越复杂,这时候我们...
分类:
其他好文 时间:
2014-05-31 19:14:41
阅读次数:
296