摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-03-14 19:49 Ci_pea 阅读(96) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 牛顿法 二分法 阅读全文
posted @ 2017-03-14 19:22 Ci_pea 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". bin():将整数x转换为二进制字符串,前面会带'0b'; int(a,2),a是二 阅读全文
posted @ 2017-03-14 18:55 Ci_pea 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leadin 阅读全文
posted @ 2017-03-14 15:48 Ci_pea 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
posted @ 2017-03-14 15:16 Ci_pea 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous(连续的) subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4, 阅读全文
posted @ 2017-03-14 14:52 Ci_pea 阅读(122) 评论(0) 推荐(0) 编辑
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2017-03-14 10:57 Ci_pea 阅读(126) 评论(0) 推荐(0) 编辑