代码改变世界

[LeetCode] 16. 3Sum Closest

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

[LeetCode] 15. 3Sum

2016-10-01 21:59 by amadis, 116 阅读, 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 阅读全文

[LeetCode] 14. Longest Common Prefix

2016-10-01 21:55 by amadis, 114 阅读, 0 推荐, 收藏, 编辑
摘要: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, 129 阅读, 0 推荐, 收藏, 编辑
摘要: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, 118 阅读, 0 推荐, 收藏, 编辑
摘要: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, 113 阅读, 0 推荐, 收藏, 编辑
摘要: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, 131 阅读, 0 推荐, 收藏, 编辑
摘要: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, 130 阅读, 0 推荐, 收藏, 编辑
摘要: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, 133 阅读, 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 阅读全文

[LeetCode #7] Reverse integer

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