摘要:
题目: 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 integ 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Write a function to find the longest common prefix string amongst an array of strings. 思路:求最长前缀子串,假设第一个字符串是最长前缀子串,采用增强for得到数组中每个字符串,分别与第一个字符串的同一位置 阅读全文
摘要:
题目: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 思路:与12题正好相反,罗马数字基本字符集:I V X L C D M (1 阅读全文
摘要:
题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 思路: 主要是了解罗马数和阿拉伯数字的对应关系,如下表: 由这个表基本上可以 阅读全文
摘要:
题目: 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 e 阅读全文
摘要:
题目: Implement regular expression matching with support for '.' and '*'. 思路:'.' 代表任意单字符,'*' 可以代表将前面的字符去掉,也可以代表是对前面字符(包括'.')的重复(数目无限)。例子: aa a //不匹配,很明显 阅读全文