文中用快慢指针详细分析了在有环路的链表上,两个指针会在何时、何地相遇,如何知道相遇点偏离了环路起点多远。
分类:
其他好文 时间:
2014-07-22 23:13:13
阅读次数:
375
Given a sorted linked list, delete all
duplicates such that each element appear onlyonce.For
example,Given1->1->2, return1->2.Given1->1->2->3->3,
retu...
分类:
其他好文 时间:
2014-07-22 23:12:13
阅读次数:
426
1. //取得结果集中行的数目示例:$count =
mysql_num_rows($result1);2. //小括号里odd代表奇数,even代表偶数 示例:tr:nth-child(odd){
background: #cad9ea; }3.//Mysql数据库li...
分类:
其他好文 时间:
2014-07-22 23:11:33
阅读次数:
423
Given a strings, partitionssuch that every
substring of the partition is a palindrome.Return all possible palindrome
partitioning ofs.For example, giv...
分类:
其他好文 时间:
2014-07-22 23:08:15
阅读次数:
446
原题地址:http://oj.leetcode.com/problems/reorder-list/题意:Given
a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You
must do this...
分类:
编程语言 时间:
2014-05-01 15:37:03
阅读次数:
441
Given a strings, partitionssuch that every
substring of the partition is a palindrome.Return the minimum cuts needed for a
palindrome partitioning ofs...
分类:
其他好文 时间:
2014-05-01 14:47:09
阅读次数:
409
这道题挺简单的,但是需要细心。最好的方法是先对string做预处理,然后再判断是否是回文。下面是AC代码:
1 /** 2 * Given a string, determine if it is a palindrome, considering only
alphanumeric ch...
分类:
其他好文 时间:
2014-05-01 01:45:34
阅读次数:
375
using System; using System.Collections.Generic;
using System.ComponentModel; using System.Data; using System.Drawing; using
System.IO; using System.Li...
分类:
其他好文 时间:
2014-05-01 01:02:33
阅读次数:
322
Problem description:given a string, find the
longest palindrome string in itSolution:1.brute force O(n^3)just enumerate start
and end of the substring...
分类:
其他好文 时间:
2014-04-29 17:22:46
阅读次数:
308
//冒泡排序publicclassbubblesorter{publicvoidsort(int[]list){inti,j,temp;booldone=false;j=1;while((jlist[i+1]){done=false;temp=list[i];list[i]=list[i+1];li...
分类:
其他好文 时间:
2014-04-29 17:21:45
阅读次数:
429