随笔分类 -  LeetCode

摘要:要求: 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点)。返回一个该链表的深度拷贝。 思路: 1、遍历该链表,复制每一个节点,插入到当前节点的后面.形成如下链表.1->1'->2->2'.... 2、将每个拷贝节点的随机指针域,指向原节点(即拷 阅读全文
posted @ 2017-04-24 16:56 小猴子爱吃桃 阅读(978) 评论(0) 推荐(0)
摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目要求不能使用除号、乘号和取余操作符。 我们使用移位操作符。<< 左移代表 阅读全文
posted @ 2017-03-21 21:15 小猴子爱吃桃 阅读(108) 评论(0) 推荐(0)
摘要:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array whic 阅读全文
posted @ 2017-03-18 14:10 小猴子爱吃桃 阅读(491) 评论(0) 推荐(0)
摘要:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文
posted @ 2017-03-17 16:17 小猴子爱吃桃 阅读(162) 评论(0) 推荐(0)
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2017-03-17 15:40 小猴子爱吃桃 阅读(211) 评论(0) 推荐(0)
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
posted @ 2017-03-16 22:28 小猴子爱吃桃 阅读(217) 评论(0) 推荐(0)
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Have you thought about this? Here are some good questions t 阅读全文
posted @ 2017-02-21 16:29 小猴子爱吃桃 阅读(1503) 评论(0) 推荐(0)
摘要:题目描述: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes 阅读全文
posted @ 2017-02-17 14:09 小猴子爱吃桃 阅读(334) 评论(0) 推荐(0)