摘要: Divide two integers without using multiplication, division and mod operator. 1 public static int Divid(int dividend, int divisor) 2 { 3 bool neg = false; 4 uint uint_dividend; 5 uint uint_divisor; 6 7 if (dividend < 0) 8 { 9 ... 阅读全文
posted @ 2012-08-29 22:36 ETCOW 阅读(325) 评论(0) 推荐(0) 编辑
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded message "12", it 阅读全文
posted @ 2012-08-29 05:50 ETCOW 阅读(387) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"two 1s"or21.21is read off as"one 2, thenone 1"or1211.Given an integern, generate thenthsequence.Note: The sequence of inte 阅读全文
posted @ 2012-08-29 05:22 ETCOW 阅读(490) 评论(0) 推荐(0) 编辑
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water 阅读全文
posted @ 2012-08-29 05:00 ETCOW 阅读(290) 评论(1) 推荐(0) 编辑