Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" O…
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car" is not a palindrome. Note: Have you consider that…
给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写. 说明:本题中,我们将空字符串定义为有效的回文串. 示例 1: 输入: "A man, a plan, a canal: Panama" 输出: true 示例 2: 输入: "race a car" 输出: false 注意:char也有大小写转换方法Character.toLowerCase().和“String“.toLowerCase()不一样. public class Val…
public class Solution { Stack<char> S = new Stack<char>(); Queue<char> Q = new Queue<char>(); public bool IsPalindrome(string s) { ) { return true; } s = s.ToLower(); foreach (var c in s) { ')) { S.Push(c); Q.Enqueue(c); } } ) { va…
算法刷题笔记 Leetcode-11. Container With Most Water Method: (对撞指针)每次保留两指针中最大的那个即可求得最大的面积 Runtime: 16 ms, faster than 95.65% of C++ online submissions for Container With Most Water. Memory Usage: 9.9 MB, less than 43.30% of C++ online submissions for Contai…