代码改变世界

[LeetCode] 26. Remove Duplicates from Sorted Array

2017-04-01 01:10 by amadis, 112 阅读, 0 推荐, 收藏, 编辑
摘要:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文

[LeetCode] 25. Reverse Nodes in k-Group

2017-04-01 01:00 by amadis, 157 阅读, 0 推荐, 收藏, 编辑
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文

[LeetCode] 24. Swap Nodes in Pairs

2016-11-05 03:35 by amadis, 150 阅读, 0 推荐, 收藏, 编辑
摘要: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. Your a 阅读全文

[LeetCode] 23. Merge k Sorted Lists

2016-10-01 22:36 by amadis, 122 阅读, 0 推荐, 收藏, 编辑
摘要:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 阅读全文

[LeetCode] 22. Generate Parentheses

2016-10-01 22:28 by amadis, 121 阅读, 0 推荐, 收藏, 编辑
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: 阅读全文

[LeetCode] 21. Merge Two Sorted Lists

2016-10-01 22:23 by amadis, 117 阅读, 0 推荐, 收藏, 编辑
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 阅读全文

[LeetCode] 20. Valid Parentheses

2016-10-01 22:20 by amadis, 174 阅读, 0 推荐, 收藏, 编辑
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文

[LeetCode] 19. Remove Nth Node From End of List

2016-10-01 22:10 by amadis, 127 阅读, 0 推荐, 收藏, 编辑
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文

[LeetCode] 18. 4Sum

2016-10-01 22:06 by amadis, 130 阅读, 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 阅读全文

[LeetCode] 17. Letter Combinations of a Phone Number

2016-10-01 22:04 by amadis, 95 阅读, 0 推荐, 收藏, 编辑
摘要:Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho 阅读全文