上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页

2014年9月16日

Remove Nth Node From End of List

摘要: Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After rem 阅读全文

posted @ 2014-09-16 09:43 bug睡的略爽 阅读(166) 评论(0) 推荐(0) 编辑

2014年9月15日

Letter Combinations of a Phone Number

摘要: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho 阅读全文

posted @ 2014-09-15 22:55 bug睡的略爽 阅读(188) 评论(0) 推荐(0) 编辑

Integer to Roman

摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 普及一下罗马计数法 The base I - 1 V - 5 X - 10 L - 阅读全文

posted @ 2014-09-15 22:23 bug睡的略爽 阅读(164) 评论(0) 推荐(0) 编辑

Regular Expression Matching

摘要: Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elemen 阅读全文

posted @ 2014-09-15 20:45 bug睡的略爽 阅读(189) 评论(0) 推荐(0) 编辑

String to Integer (atoi)

摘要: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文

posted @ 2014-09-15 15:27 bug睡的略爽 阅读(143) 评论(0) 推荐(0) 编辑

Add Two Numbers

摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文

posted @ 2014-09-15 11:11 bug睡的略爽 阅读(169) 评论(0) 推荐(0) 编辑

2014年9月7日

Pow(x, n)

摘要: Implement pow(x, n). 这题主要考察分治法,这样效率就可达到O(logn) 需要注意的是:n>0时 n为偶数时 xn = xn/2 * xn/2,n为奇数时 xn = x(n-1)/2 * x(n-1)/2 * x n=0时 ,xn = 1 n<0时 xn = 1 / x-n 代码 阅读全文

posted @ 2014-09-07 22:27 bug睡的略爽 阅读(153) 评论(0) 推荐(0) 编辑

Implement strStr()

摘要: Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 方法一:暴力破解,O(mn),超时,写了这段 阅读全文

posted @ 2014-09-07 21:32 bug睡的略爽 阅读(163) 评论(0) 推荐(0) 编辑

2014年9月6日

Edit Distance

摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文

posted @ 2014-09-06 21:05 bug睡的略爽 阅读(125) 评论(0) 推荐(0) 编辑

Sqrt(x)

摘要: Implement int sqrt(int x). Compute and return the square root of x. 传说中的牛顿法,请查看百度百科 某人说我偷懒,那我就决定还是翻些资料出来比较好。。。 牛顿法主要用于两方面,一是求方程根,二是最优化处理。 求方程根的原理是利用泰勒 阅读全文

posted @ 2014-09-06 20:30 bug睡的略爽 阅读(186) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页

导航