摘要: Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
posted @ 2015-09-12 23:34 vincently 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-09-12 23:14 vincently 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the... 阅读全文
posted @ 2015-09-12 17:52 vincently 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 答案是7次。1. 首先将25匹马分成5组a、b、c、d、e进行比赛。比赛的次数就是5次。得到每组的第一名,分别编号a1,b1,c1,d1,e1。2. 然后我们将每组的第一名进行比赛,得出结果。假设a1>b1>c1>d1>e1。(大于号表示a1比b1快,1表示第一名)。在这个地方我们可以推断出,a1是... 阅读全文
posted @ 2015-09-12 14:46 vincently 阅读(3614) 评论(0) 推荐(0) 编辑