Python 刷Leetcode题库,顺带学英语单词(31)

Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. [#125]

"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.

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.


本文转载自: https://blog.csdn.net/boysoft2002/article/details/118978941
版权归原作者 Hann Yang 所有, 如有侵权,请联系我们删除。

“Python 刷Leetcode题库,顺带学英语单词(31)”的评论: