摘要: Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.needle in the haystack 大海捞针的意思其实就是找出 “短字符串” 在 “长字符串” 中的位置。 1 public static string strStr(string haystack, string needle) 2 { 3 if (haystack.Length == 0) 4... 阅读全文
posted @ 2012-09-07 05:47 ETCOW 阅读(1420) 评论(2) 推荐(0) 编辑
摘要: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.For example, given n = 2, return [0,1,3,2]. Its gray c 阅读全文
posted @ 2012-09-07 04:58 ETCOW 阅读(529) 评论(0) 推荐(0) 编辑