2017年7月20日
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2017-07-20 19:08 Beserious 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 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-07-20 18:05 Beserious 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 二分可解 这里是关于二分的一些总结: 首先,如果题目属于"二分值越大越符合条件",即要求符合条件的最小值,那就是while(r>l){mid=(l+r)/2。。。} 阅读全文
posted @ 2017-07-20 16:32 Beserious 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 模拟二进制相加,右对齐,然后每位相加....不知道字符串左加和右加对性能有没有影响 阅读全文
posted @ 2017-07-20 13:45 Beserious 阅读(113) 评论(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-07-20 11:51 Beserious 阅读(156) 评论(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-07-20 11:48 Beserious 阅读(93) 评论(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,-1,2, 阅读全文
posted @ 2017-07-20 08:13 Beserious 阅读(115) 评论(0) 推荐(0) 编辑