摘要: Note: 思路:按照位相加,多余的位数只需要加进位就可以了,如果是最后进位为1,千万不要忘了。 代码: 1.是从末尾开始相加,还要注意进位。 2.返回的是string类型,用arrays的话在leetcode提交不成功。 3.数组的下表是一门技巧。 阅读全文
posted @ 2017-06-05 11:27 牛虻爱吃饭 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front 阅读全文
posted @ 2017-06-01 17:34 牛虻爱吃饭 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. to 阅读全文
posted @ 2017-06-01 17:28 牛虻爱吃饭 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2017-06-01 17:20 牛虻爱吃饭 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -- 阅读全文
posted @ 2017-05-18 17:24 牛虻爱吃饭 阅读(401) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2017-05-18 11:26 牛虻爱吃饭 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 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-05-18 09:25 牛虻爱吃饭 阅读(182) 评论(0) 推荐(0) 编辑
摘要: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
posted @ 2017-05-16 09:32 牛虻爱吃饭 阅读(206) 评论(0) 推荐(0) 编辑
摘要: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c 阅读全文
posted @ 2017-05-16 08:57 牛虻爱吃饭 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are given p 阅读全文
posted @ 2017-05-16 08:40 牛虻爱吃饭 阅读(567) 评论(0) 推荐(0) 编辑