2016年9月5日

[LeetCode]24. Swap Nodes in Pairs

摘要: 题目: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Yo 阅读全文

posted @ 2016-09-05 21:49 医生工程师 阅读(119) 评论(0) 推荐(0) 编辑

[LeetCode]160. Intersection of Two Linked Lists

摘要: 题目: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: 判断两个链表是 阅读全文

posted @ 2016-09-05 21:04 医生工程师 阅读(102) 评论(0) 推荐(0) 编辑

2016年9月4日

[LeetCode]206. Reverse Linked List 解题小结

摘要: 题目: Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement 阅读全文

posted @ 2016-09-04 16:54 医生工程师 阅读(104) 评论(0) 推荐(0) 编辑

[LeetCode]203. Remove Linked List Elements 解题小结

摘要: 题目: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 阅读全文

posted @ 2016-09-04 10:51 医生工程师 阅读(139) 评论(0) 推荐(0) 编辑

[LeetCode] 83. Remove Duplicates from Sorted List

摘要: 题目: 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 阅读全文

posted @ 2016-09-04 10:19 医生工程师 阅读(144) 评论(0) 推荐(0) 编辑

[Leetcode]141. Linked List Cycle

摘要: 题目: Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 让head不断走一步,如果cur不为null,走两步,这样如果存在cy 阅读全文

posted @ 2016-09-04 09:29 医生工程师 阅读(71) 评论(0) 推荐(0) 编辑

2016年9月2日

【LeetCode】389. Find the Difference

摘要: 题目: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter 阅读全文

posted @ 2016-09-02 14:13 医生工程师 阅读(178) 评论(0) 推荐(0) 编辑

【LeetCode】202. Happy Number

摘要: 题目: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive in 阅读全文

posted @ 2016-09-02 11:41 医生工程师 阅读(129) 评论(0) 推荐(0) 编辑

2016年8月31日

【LeetCode】242. Valid Anagram 解题小结

摘要: 题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", 阅读全文

posted @ 2016-08-31 14:50 医生工程师 阅读(146) 评论(0) 推荐(0) 编辑

【LeetCode】290. Word Pattern 解题小结

摘要: 题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a l 阅读全文

posted @ 2016-08-31 10:14 医生工程师 阅读(169) 评论(0) 推荐(0) 编辑

导航