摘要: Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers.Have you thought about this?Here are some good questions to ask be... 阅读全文
posted @ 2015-12-24 16:09 0giant 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which com... 阅读全文
posted @ 2015-12-24 14:15 0giant 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 作者:阮一峰日期:2013年5月 1日字符串匹配是计算机的基本任务之一。举例来说,有一个字符串"BBC ABCDAB ABCDABCDABDE",我想知道,里面是否包含另一个字符串"ABCDABD"?许多算法可以完成这个任务,Knuth-Morris-Pratt算法(简称KMP)是最常用的之一。它以... 阅读全文
posted @ 2015-12-24 13:41 0giant 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->... 阅读全文
posted @ 2015-12-24 10:55 0giant 阅读(241) 评论(0) 推荐(0) 编辑