Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”.
(寻找最长公共前缀序列)
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”.
(寻找最长公共前缀序列)
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M for 1, 5, 10, 50, 100, 500 and 1000.
(罗马字符转整数)
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M for 1, 5, 10, 50, 100, 500 and 1000.
(整数转罗马字符)
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 endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
Note: You may not slant the container and n is at least 2.
(求最大矩形面积)
Given an input string (s) and a pattern (p), implement regular expression matching with support for . and *, . matches any single character, * matches zero or more of the preceding element. The matching should cover the entire input string (not partial).
(字符串正则表达式匹配)
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
(判断数字是否是回文序列)
Implement atoi which converts a string to an integer.
(字符串转32位整形)
Given a 32-bit signed integer, reverse digits of an integer.
(翻转一个有符号整形数值字符串)
Note:
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: \([−2^{31}, 2^{31} − 1]\). For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this:1
2
3P A H N
A P L S I I G
Y I R
And then read line by line: “PAHNAPLSIIGYIR”.
(字符串ZIGZAG之后按行输出)
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
(寻找最长回文序列)