代码改变世界

随笔档案-2016年10月

[LeetCode] 23. Merge k Sorted Lists

2016-10-01 22:36 by amadis, 126 阅读, 收藏,
摘要: 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, 128 阅读, 收藏,
摘要: 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, 126 阅读, 收藏,
摘要: 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, 182 阅读, 收藏,
摘要: 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, 134 阅读, 收藏,
摘要: 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, 137 阅读, 收藏,
摘要: 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, 99 阅读, 收藏,
摘要: 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 阅读全文

[LeetCode] 16. 3Sum Closest

2016-10-01 22:01 by amadis, 103 阅读, 收藏,
摘要: 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. 阅读全文

[LeetCode] 15. 3Sum

2016-10-01 21:59 by amadis, 121 阅读, 收藏,
摘要: 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 阅读全文

[LeetCode] 14. Longest Common Prefix

2016-10-01 21:55 by amadis, 125 阅读, 收藏,
摘要: Write a function to find the longest common prefix string amongst an array of strings. 阅读全文

[LeetCode #13] Roman to Integer

2016-10-01 21:51 by amadis, 133 阅读, 收藏,
摘要: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 阅读全文

[LeetCode #12] Integer to Roman

2016-10-01 21:45 by amadis, 123 阅读, 收藏,
摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 阅读全文

[LeetCode #11] Container With Most Water

2016-10-01 21:44 by amadis, 121 阅读, 收藏,
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文

[LeetCode #10] Regular Expression Matching

2016-10-01 21:35 by amadis, 136 阅读, 收藏,
摘要: Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elemen 阅读全文

[LeetCode #9] Palindrome Number

2016-10-01 11:57 by amadis, 139 阅读, 收藏,
摘要: Determine whether an integer is a palindrome. Do this without extra space. 阅读全文

[LeetCode #8] String to Integer (atoi)

2016-10-01 11:43 by amadis, 139 阅读, 收藏,
摘要: 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 阅读全文

[LeetCode #7] Reverse integer

2016-10-01 11:40 by amadis, 135 阅读, 收藏,
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 阅读全文

[LeetCode #6] ZigZag Conversion

2016-10-01 11:37 by amadis, 121 阅读, 收藏,
摘要: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font 阅读全文

[LeetCode #5] Longest Palindromic Substring

2016-10-01 11:25 by amadis, 126 阅读, 收藏,
摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文

[LeetCode #4] Median of Two Sorted Arrays

2016-10-01 11:03 by amadis, 168 阅读, 收藏,
摘要: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文