摘要: 相似题目:Palindrome NumberValid PalinDromeReverseLinked ListPalindrome Linked ListGiven a string, determine if it is a palindrome, considering only alphan... 阅读全文
posted @ 2015-05-25 09:56 江湖小妞 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文
posted @ 2015-05-23 18:25 江湖小妞 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1version2返回 1, ifversion1str2.length?str1.length:str2.length; ... 阅读全文
posted @ 2015-05-23 10:50 江湖小妞 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 1.String的split()方法。 String str.split("***")方法,用的是正则匹配。因此如果要用特殊字符来分割字符串时要用到转义字符。常用的分割字符的转义形式如下:String version1 = "345.4567";String[] str1 = version1.s... 阅读全文
posted @ 2015-05-23 10:16 江湖小妞 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 ->... 阅读全文
posted @ 2015-05-19 17:46 江湖小妞 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2015-05-19 16:42 江湖小妞 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 ... 阅读全文
posted @ 2015-05-19 10:22 江湖小妞 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Given an integern, return the number of trailing zeroes inn!.问题描述:给出一个正整数n,计算n!结构后面有几个0.要求:在多项式时间中完成算法。常规思路:计算n!,然后统计一下后面有几个0,但是这种算法一想就知道肯定会超出时间限制。巧妙思... 阅读全文
posted @ 2015-05-18 22:23 江湖小妞 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-05-18 15:51 江湖小妞 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -- 阅读全文
posted @ 2015-05-18 11:22 江湖小妞 阅读(208) 评论(0) 推荐(0) 编辑