Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. [#125]
Example:
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a palindrome.
Have you consider that the string might be empty? This is a good question to ask during an interview.
For the purpose of this problem, we define empty string as valid palindrome.
Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. [#128]
Your algorithm should run in O(n) complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4].
Therefore its length is 4.
版权归原作者 Hann Yang 所有, 如有侵权,请联系我们删除。